![](/img/trans.png)
[英]Using SSH Keygen not able to connect to server on Windows 10 GIT
[英]Git connect using ssh on windows
我已經閱讀了一些問題,但仍未找到解決此問題的方法
我在Windows上有git,我想使用ssh連接到github。 按照本教程https://help.github.com/articles/generating-ssh-keys我已經成功設置了我的密鑰
如果我打開一個git-bash並嘗試ssh github我能夠連接,所以這是有效的
ssh -T git@github.com
Hi username! You've successfully authenticated, but GitHub does not
provide shell access.
這意味着git-bash實際上看到了我的密鑰。 但是,如果我嘗試推動
git push origin master
git提示我輸入用戶名和密碼
謝謝您的幫助
編輯:通過使用git協議而不是http協議解決,我的錯
所以取代這個
https://github.com/_user_/_repository_.git
這個
git@github.com:_user_/_repository_.git
在遠程鏈接中
無需刪除/添加,只需執行以下操作:
git remote set-url origin git@github.com:username/repo.git
您可能克隆了使用https協議的遠程,而不是git協議。 您需要重新定義遙控器的原點 。
# Change this as needed.
github_username="$LOGNAME"
# Replace your remote, then push.
git remote rm origin
git remote add origin "git@github.com:${github_username}/${PWD##*/}.git"
git push --tags --set-upstream origin master
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.