因爲我希望能夠使用push
代碼使用多個身份/密鑰。要做到這一點我在01定義一些別名:如何使用別名訪問遠程存儲庫?
#github.com default
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_foo
#github.com-foo
Host github.com-foo
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_foo
#github.com-bar
Host github.com-bar
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_bar
...
要訪問我的回購我用那麼別名,例如:
$ git remote add origin [email protected]:MyOrganizationOrPersonalAccount/MyRepo.git
$ git remote -v
origin [email protected]:MyOrganizationOrPersonalAccount/MyRepo.git (fetch)
origin [email protected]:MyOrganizationOrPersonalAccount/MyRepo.git (push)
這已經可以正常使用了很長一段時間。而現在(可能是因爲我重新安裝了OS)沒有關係的工作了:
$ git fetch
Unable to open connection:
Host does not existfatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
什麼可能導致此問題,以及如何獲得遠程訪問工作?
UPDATE
我重新安裝的Git是舒爾,我使用OpenSSH客戶端。現在它可以工作。所以我想這個問題是由於使用plink作爲SSH客戶端引起的,並不考慮~/.ssh/config
的設置。
你的鑰匙變得無效?你有沒有嘗試添加新的密鑰? – TheGeorgeous
@TheGeorgeous哦,對不起,只是忘了發佈CLI輸出。更新了問題。 – automatix
你有沒有用別名試過這個'ssh -T git @ github.com'? – TheGeorgeous