Question

I'm attempting to configure Git for web deployment purposes, according to the directions provided here. However, I can only get as far as step two before things start to go awry.

Now the instructions say to input the following:

git remote add myServer myUsername@ServerHostname:~/path/to/myRepo.git

So I go ahead and plug in

git remote add xxxyyy user@XXX.XXX.XX.XXX:/var/myRepo.git

because I've created the repo--as instructed--outside my web directory. However, doing so gets me the following:

fatal: Not a git repository (or any of the parent directories): .git

So I'm not sure if I'm misinterpreting something in the command syntax or what, but I'm quite confused. As far as specifics are concerned, the environment I'm looking to deploy to is a VPS I've setup with Digital Ocean, and the environment I'm looking to develop in and deploy from is a Xubuntu virtualbox.

EDIT: Problem has been solved with VonC's most gracious assistance. Thanks to everyone who contributed!

Was it helpful?

Solution

You need to be in your local repo (the one you want to be deployed) in order to make that command.

 cd /path/tpo/your/local/repo
 git remote add xxxyyy user@XXX.XXX.XX.XXX:/var/myRepo.git

Then you will be able to push (and populate) the bare repo on the server with:

 git push -u myServer master

(sill executed from your local repo folder)

Note the -u: I like to establish a remote tracking branch relationship between your local master and your server repo master, especially when the remote repo is empty.
See "Why do I need to explicitly push a new branch?"
After that, a simple git push will be enough.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top