設置ssh key后push為什么還要輸入用戶名和密碼


$ git push Username for 'https://github.com': Password for 'https://Username@github.com': Counting objects: 562, done. Delta compression using up to 4 threads. Compressing objects: 100% (542/542), done. Writing objects: 100% (561/561), 2.51 MiB | 69.00 KiB/s, done. Total 561 (delta 79), reused 0 (delta 0)

 

因為你用的是https而不是ssh。 你可以更新一下origin

git remote remove origin git remote add origin git@github.com:Username/Your_Repo_Name.git 

之后你還需要重新設置track branch,比如:

git branch --set-upstream-to=origin/master master 

對於HTTPS方式,你可以在~/.netrc文件里設定用戶名密碼,不過這樣的風險在於密碼是明文存放在這個文件里的,比較容易泄露

machine github.com login Username password Password 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM