git over ssh


Transferring a git repository around seems to get interesting.

Yesterday I wanted to copy a local git project to USB; copying all the ordinary files worked but many files in the git repo are read-only so they wouldn't copy.  

I found git fetch <path/to/local/git.repo> worked - kind of.  I still had a lot of historical stuff on my USB copy that hadn't been removed.  So I checked all those items could be removed and removed part of the problem.  However, one file was still showing up 

git pull <path/to/local/git.repo> worked better - pulling over the repository and the files.

Today I needed to pull a git project off my server and found I could use ssh as a protocol.

I am so thankful to Scott Chacon and Ben Straub for Chapter 4 in the Git Pro book.  

I already looked at git help clone page and leapt in to try git clone ssh:// but this wasn't working and complained about permissions.

I didn't see the scp entry in the manual pages but retrieved the Git Pro Book above and skipped to Chapter 4.  So git clone worked.  In case you're wondering, git clone ssh:// didn't work - reporting the same permissions problems before - namely:


fatal: '/path/to/remote/git.repo' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.


I also tried git clone ssh://<user>@<, which also worked.