$ git clone ssh://123.45.67.89:29418/Code/MyApp.git
Cloning into 'MyApp'...
Unable to negotiate with 123.45.67.89: no matching key exchange method found.
Their offer: diffie-hellman-group1-sha1
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists. my_name@my_host
或是在連線時發生:
$ ssh -p 29418 123.45.67.89
Unable to negotiate with 123.45.67.89: no matching key exchange method found.
Their offer: diffie-hellman-group1-sha1
首先要檢查是否有設定 ~/.ssh/config 這個檔案
檔案內容可能如下:
HOST 123.45.67.89
PORT 29418
USER my_name
但因為是 windows 上使用模擬的 console (cygwin or git-bash ...etc) ,或是 ssh 的版本有問題,出現上述的 error 時,建議在下方加入這行
HOST 123.45.67.89
PORT 29418
USER my_name
KexAlgorithms +diffie-hellman-group1-sha1
再次執行
$ ssh -p 29418 123.45.67.89
==========================================================
**** Welcome to Gerrit Code Review ****
Hi matt, you have successfully connected over SSH.
Unfortunately, interactive shells are disabled.
To clone a hosted Git repository, use:
git clone ssh://my_name@123.45.67.89:29418/REPOSITORY_NAME.git
Connection to 123.45.67.89 closed.
==========================================================
這樣就代表你連成功了!
如果是使用 TortoiseGit + ssh 又不想打帳密,還可以參考這篇 PuTTYgen
http://floatfrog.blogspot.tw/2015/06/tortoisegitssh-keygitlab.html