How to clone a git repository via SSH public key authentication without using user name in git clause?
I am using pass-phrase protected SSH public/private key authentication to access my git repository via SSH in Windows.
First, I try the Putty solution by using plink.exe and pageant.exe. I have GIT_SSH variable set to plink.exe.
If I attempt to clone a repository:
c:\> git clone ssh://git.example.com/srv/repos/git/project.git project
I got error:
Cloning into project...
fatal: The remote end hung up unexpectedly
This is due to I didn't specify user name for ssh access.
Adding user name will make the clone work:
c:\> git clone ssh://user@git.example.com/srv/repos/git/project.git project
T开发者_Python百科he reason I don't add user name to git clone is I am using submodule that doesn't specify user name in .gitmodules.
Is there anyway to make git + plink using user name specify somewhere else?
Next, I try the default ssh.exe of msysgit, I may specify user name in %HOME%/.ssh/config. However, I couldn't get ssh-agent.exe and ssh-add.exe work with passphrased protected private key.
精彩评论