github 不用數賬號和密碼的倆種方法

工作中有時候經常pull代碼和推送push代碼,會很煩的老是輸入用戶和密碼。

這裏可以教大家,讓大家免去輸入用戶和密碼的煩瑣。

在使用git的時候,如果你是用ssh協議的話,必須要提交你的公鑰匙給git,

ssh-keygen -C '[email protected]' -t rsa       密碼直接回車,然後家目錄中.ssh 中id_rsa.pub打開復制KEY,到git官網進行填寫

ssh -T [email protected]            驗證祕鑰是否成功


如果你不是用ssh協議,用的是https協議



linux下


在~/下, touch創建文件 .git-credentials, 用vim編輯此文件,輸入內容格式:


touch .git-credentials


vim .git-credentials


https://{username}:{password}@github.com



2. 在終端下執行  git config --global credential.helper store

3. 可以看到~/.gitconfig文件,會多了一項:

[credential]


    helper = store


設置完成

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