How can I push a git repository to a folder over SSH?

Posted by Rich on Super User See other posts from Super User or by Rich
Published on 2011-01-08T18:39:52Z Indexed on 2011/01/08 18:55 UTC
Read the original article Hit count: 145

Filed under:

I have a folder called my-project inside which I've done git init, git commit -a, etc.

Now I want to push it to an empty folder at /mnt/foo/bar on a remote server.

How can I do this?

I did try, based on what I'd read:

cd my-project
git remote add origin ssh://user@host/mnt/foo/bar/my-project.git
git push origin master

which didn't seem right (I'd assume source would come before destination) and it failed:

fatal: '/mnt/boxee/git/midwinter-physiotherapy.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

I'd like this to work such that I don't have to access the remote host and manually init a git repository every time ... do I have to do that? Am I going down the right route at all?

Thanks.

© Super User or respective owner

Related posts about git