git clone over ssh creates a local repo instead of a remote repo
I have the following
me@mba ~/Documents/myproj$ll
total 8
drwxr-xr-x 13 punkish staff 442 Sep 5 15:13 .git/
-rw-r--r-- 1 punkish staff 193 Sep 5 13:28 foo.pl
me@mba ~/Documents/myproj$git clone --bar开发者_如何学编程e . ssh://me@macpro.edu:2200/~/Repos/myproj/
Cloning into bare repository ssh://me@macpro.edu:2200/~/Repos/myproj... done.
me@mba ~/Documents/myproj$ll
total 8
drwxr-xr-x 13 punkish staff 442 Sep 5 15:13 .git/
-rw-r--r-- 1 punkish staff 193 Sep 5 13:28 foo.pl
drwxr-xr-x 3 punkish staff 102 Sep 5 15:20 ssh:/
me@mba ~/Documents/myproj$
huh! What happened there? Instead of a bare repo getting created on the remote computer over ssh port 2200, it got created right in the current directory on my laptop. I am doing something silly but it is not obvious to me.
ssh -p 2200 me@macpro.edu 'mkdir -p ~/Repos/myproj && cd ~/Repos/myproj && git init --bare'
git remote add origin ssh://me@macpro.edu:2200/~/Repos/myproj/
git push origin master
Should work. At least this is the idea: Login into the remote and create the bare repository. Then on your local machine add the newly created bare repository as remote and push everything you like.
However, you can also create a local clone of your repository and then copy the whole folder using scp
or rsync
or such to your remote.
精彩评论