Yimin Rong
Yimin Rong

Reputation: 2027

Transfer a project to git?

I have a project on a local machine, and a git repository on a remote server. Is there a way I can push/commit/transfer this project to the remote server? It's telling me "not a git repository", I know that! I just want it on the remote server.

Upvotes: 0

Views: 190

Answers (3)

William Seiti Mizuta
William Seiti Mizuta

Reputation: 7985

Your remote repository must be a bare repository. Otherwise you can't push to this remote repository. To create it, just pass the option bare: git init --bare.

Upvotes: 0

Adam K Dean
Adam K Dean

Reputation: 7475

You could clone the remote repo onto your local machine, copy your files into the directory, add the new files, commit them and push them back to the remote server.

cd /to/some/directory
git clone [uri]

Then copy your files into the directory

git add -A
git commit -m "Added local project files"
git push origin master

Assuming you know git, you should be able to get this to work.

Upvotes: 4

theaccordance
theaccordance

Reputation: 889

Is the project a git repo yet? If not, you'll need to first initialize it as a git repository on the local machine, make sure that all the project files are committed, and then push the project files to the remote repo.

Upvotes: 0

Related Questions