解決每次git pull需要輸入用戶名密碼的問題

解決每次git pull需要輸入用戶名密碼的問題

 

問題描述

在服務器上每次執行git pull,都提示輸入用戶名和密碼

現象分析

我們在git clone工程時有2中形式 https git@git。當你使用前者拉取工程時每次都需要輸入用戶名和密碼

解決方案

1.執行下面命令

git config --global credential.helper store

這個時候~/.gitconfig文件中會多一行

[credential]
helper = store

2.執行git pull再次輸入用戶名和密碼

此時你會看到/root/.git-credentials中會多一行內容。裏面的內容類似https://{username}:{password}@github.com這種形式

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章