[英]msysgit git clone ignores ssh config
我已經安裝了msysgit,並且git使用了正確的ssh.exe。 所有命令都在msysgit shell(程序文件x86 sh.exe)中執行。 然后我將〜/ .ssh / config文件設置為此
LogLevel DEBUG1
Host bitbucket.com
HostName bitbucket.com
PreferredAuthentications publickey
IdentityFile /d/ssh/bitbucket.ppk
IdentitiesOnly yes
然后ssh bitbucket.com
可以正常工作:
$ ssh bitbucket.com
debug1: Connecting to bitbucket.com [131.103.20.173] port 22.
debug1: Connection established.
debug1: identity file /d/ssh/bitbucket.ppk type -1
debug1: identity file /d/ssh/bitbucket.ppk-cert type -1
但是當我嘗試git clone git@bitbucket.org:User/reponame.git
ssh調試消息時,它顯示ssh甚至不嘗試選擇bitbucket ppk,而是嘗試使用默認密鑰:
$ git clone git@bitbucket.org:user/reponame.git
Cloning into 'reponame'...
debug1: Connecting to bitbucket.org [131.103.20.168] port 22.
debug1: Connection established.
debug1: identity file /c/Users/bob/.ssh/id_rsa type -1
debug1: identity file /c/Users/bob/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/bob/.ssh/id_dsa type -1
debug1: identity file /c/Users/bob/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/bob/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/bob/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/bob/.ssh/id_ed25519 type -1
debug1: identity file /c/Users/bob/.ssh/id_ed25519-cert type -1
我沒主意了。
$ where git
C:\Program Files (x86)\Git\bin\git.exe
C:\Program Files (x86)\Git\cmd\git.exe
git clone git@bitbucket.org:User/reponame.git
將查找~/.ssh/id_rsa
和id_rsa.pub
,而不是/d/ssh/bitbucket.ppk
。
應該起作用(因為ssh bitbucket.com
起作用)是:
git clone bitbucket.com:User/reponame.git
那實際上將使用~/.ssh/config
文件中定義的參數。
bitbucket.com
是配置文件中的條目(可以使用任何名稱),但HostName
必須確實是bitbucket.org
,這是Git存儲庫的存儲域。
原因是我自己的疏忽。 Bitbucket使用bitbucket.org進行回購。 Afaik,在使用bitbucket.com之前。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.