當前位置:編程學習大全網 - 圖片素材 - 怎樣連接git遠程倉庫,設置用戶名和密碼

怎樣連接git遠程倉庫,設置用戶名和密碼

當使用HTTPS協議推送代碼到Git倉庫時,發現每次都需要輸入密碼,操作起來非常麻煩。下面介紹幾種免去輸入密碼的方法。

HTTPS協議推送

使用HTTPS協議,有壹種簡單粗暴的方式是在遠程地址中帶上密碼。

> git remote set-url origin :<用戶名>/版本庫名

或者

> git remote -v

> git remote set-url origin git@github.com:<用戶名>/版本庫名

執行推送。

> git push -u origin master

發現提示權限不夠。

The authenticity of host 'bitbucket.org (104.192.143.1)' can't be established.

RSA key fingerprint is SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'bitbucket.org,104.192.143.1' (RSA) to the list of kn

own hosts.

Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

需要在本地創建該帳號的RSA Key。可以參考以下兩篇文章:

Windows下配置SSH連接Github

Git如何在本地生成多個SSH key

然後再執行推送。

> git push -u origin master

就可以推送成功了。

  • 上一篇:全球最大訪問量的20個網站排名,騰訊百度等五家上榜
  • 下一篇:8848鈦金手機M6正式發布,為何網友戲稱智商收割機?
  • copyright 2024編程學習大全網