在ubuntu系統中,如何避免git每次提交都輸入用戶名和密碼?
操作步聚如下:
1: cd 回車; 進入當前用戶目錄下;
2: vim .git-credentials (如果沒有安裝vim 用其它編輯器也可以或 sudo apt-get install vim 安裝一個)
3:按照以下格式輸入內容
https://{username}:{password}@github.com
其中username,password,github.com 都換成你自己的內容
4:保存退出后執行下面命令
git config --global credential.helper store
執行完后
/home/用戶名/.gitconfig 會新增一項
helper = store
這是再執行git push/pull的時候就不會在要求你輸入密碼了
當然,還有一種方式就是在git clone 的時候 ,不用https://的形式,而用git@git (ssh)的形式。這種方式也可以避免每次都要輸密碼。
最后,如果是在mac os x 或windows平台下,還可以用sourcetree 這樣的ide工具,不過現在好要翻牆才能下載了。