天天看點

git push送出代碼到遠端倉庫重複輸入使用者名密碼

git push送出代碼到遠端倉庫重複輸入使用者名密碼

1. 建立遠端倉庫後預設送出協定

git push送出代碼到遠端倉庫重複輸入使用者名密碼

2. 指令行輸入

//增加 wincred 配置
$ git config --global credential.helper wincred
//如果需要删除 wincred 配置,執行下面語句
$ git config --global --unset credential.helper wincred      
git push送出代碼到遠端倉庫重複輸入使用者名密碼

3. 執行後檢視

$ vim ~/.gitconfig      
git push送出代碼到遠端倉庫重複輸入使用者名密碼

設定成功之後,之後git push 送出時首次輸入密碼之後以後就不用輸入密碼可直接送出了

1. 建立SSH KEY

如果C槽使用者目錄下有沒有.ssh目錄,有的話看下裡面有沒有id_rsa和id_rsa.pub這兩個檔案,執行指令

$ ssh-keygen -t rsa -C "[email protected]"      

其中[email protected] 為你的注冊郵箱

2. 設定SSH Key

git push送出代碼到遠端倉庫重複輸入使用者名密碼
git push送出代碼到遠端倉庫重複輸入使用者名密碼

複制id_rsa.pub内容到

git push送出代碼到遠端倉庫重複輸入使用者名密碼
git push送出代碼到遠端倉庫重複輸入使用者名密碼

3. 切換克隆模式為SSH

git push送出代碼到遠端倉庫重複輸入使用者名密碼

4. 添加遠端倉庫

//關聯遠端倉庫
$ git remote add origin [email protected]:username/test.git
// 克隆遠端倉庫
git clone [email protected]:username/test.git      

3. 再次推送本地檔案到遠端倉庫,可看到成功

$ git push -u p3c-master master      
git push送出代碼到遠端倉庫重複輸入使用者名密碼

參考文獻:

https://blog.csdn.net/cn_1937/article/details/90714019 https://blog.csdn.net/DavidFFFFFF/article/details/88849419 https://www.cnblogs.com/7day/p/10966086.html https://www.liaoxuefeng.com/wiki/896043488029600/898732864121440