views:

1248

answers:

3

I've setup a git repository one a remote server. Now I'm trying to checkout from it with:

git fetch ssh://[email protected]/~username/workfolder/

but I get an error:

fatal: Not a git repository

What am I doing wrong? Could it be the server does not support Git+SSH?

+12  A: 

Try

git clone ssh://[email protected]/~username/workfolder/

Which will create the repository on your local machine. Any commits you make to that branch are to your local repository, and when you want to push back up to the remote server you can run:

git push ssh://[email protected]/~username/workfolder/
Andy Hume
Yeah that's what I thought. So after that, if I do a commit does it just go to my local repository? What about remote? I haven't quite grasped how I should be using Git.
alamodey
Yes, it would commit to your local repository, and when you want to send back to the remote you do 'git push [remote]'.
Andy Hume
+3  A: 

git fetch fails because it expects to be run from within an existing git repository. As Andy Hume notes, you must first git clone to create a local copy of an existing repo.

Further, it defines a git remote called origin which is set to the URL that you cloned from. This is the default remote used when you type git fetch or git pull to retrieve new commits into your local repository, and the default destination when you git push to push your new local commits out to a remote repository. You do not need to include ssh://[email protected]/~username/workfolder/ in your push command if that is where you cloned from.

Here are some other useful references, from http://gitready.com/:

Emil
A: 

Could be the tilde ~ Try: ssh://[email protected]/username/workfolder

Troy