⑴ 設置git的用戶名郵箱和密碼
設置全局用戶名
設置全局郵箱
設置全局密碼
查看用戶列表
⑵ 怎樣連接git遠程倉庫,設置用戶名和密碼
當使用HTTPS協議推送代碼到Git倉庫時,發現每次都需要輸入密碼,操作起來非常麻煩。下面介紹幾種免去輸入密碼的方法。
HTTPS協議推送
使用HTTPS協議,有一種簡單粗暴的方式是在遠程地址中帶上密碼。
> git remote set-url origin http://yourname:[email protected]/yourname/project.git
還有一種方法,是創建文件存儲Git用戶名和密碼。
以Windows環境為例,在%USERPROFILE%目錄中(一般為C:\Users\yourname),打開Git Bash命令行,創建文件
> touch .git-credentials
在文件中輸入倉庫域名,這里使用了bitbucket.org。
https://yourname:[email protected]
在CMD終端中設置在全局Git環境中,長期存儲密碼
> git config --global credential.helper store
其他設置密碼方式
記住密碼(默認15分鍾):git config --global credential.helper cache
自定義存儲時間:git config credential.helper 'cache --timeout=3600'
SSH協議推送
如果原來的推送地址協議是HTTPS,可以通過換成SSH協議,在遠程倉庫添加SSH Key來實現推送時免賬戶密碼輸入。
> git remote -v // 查看遠程地址
> git remote rm origin // 刪除原有的推送地址
> git remote add origin [email protected]:<用戶名>/版本庫名
或者
> git remote -v
> git remote set-url origin [email protected]:<用戶名>/版本庫名
執行推送。
> git push -u origin master
發現提示許可權不夠。
The authenticity of host 'bitbucket.org (104.192.143.1)' can't be established.
RSA key fingerprint is SHA256:.
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
就可以推送成功了。
⑶ Git里怎麼為各個開發者設置用戶名和密碼
可以設置用戶名和密碼,但是這個只能作為服務端授權,顯示是誰提交的還是由客戶端自己設置。
⑷ git如何設置賬號密碼從而每次項目中的組員更新或者提交代碼的時候都需要輸入賬號和密碼
插入如下代碼使項目中的組員每次修改數據都要輸入賬號和密碼:
gitconfig--globaluser.name[username]
gitconfig--globaluser.password[userpassword]
PS:想要保存密碼,則需要插入如下代碼:git config –global credential.helper store。
⑸ git 使用全局記住用戶名密碼後是明文,有沒有加密的方式
在mac機器上可以下載osxkeychain工具(https://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain),將下載的git-credential-osxkeychain挪到git安裝目錄下,然後使用命令
gitconfig--globalcredential.helperosxkeychain
來告訴git使用osxkeychain方式加密保存密碼。
在windows上可以下載winstore工具(https://gitcredentialstore.codeplex.com/),但是這個工具不再繼續被維護了,是否和當前git版本兼容只能你自己試一試了。
在其他linux系統上是明文保存的,git假設用戶的home文件夾是安全的,其中用來存儲git密碼信息的文件是只有這個用戶自己能讀寫的。
⑹ 怎樣解決Ubuntu系統中git每次提交都要輸入密碼
git每次提交都要輸入密碼解決方法操作步聚如下:
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或Uindows平台下,還可以用sourcetree 這樣的ide工具,不過現在好要FQ才能下載了。
git每次提交都要輸入密碼解決方法二:
創建文件存儲GIT用戶名和密碼
在%HOME%目錄中,一般為C:\users\Administrator,也可以是你自己創建的系統用戶名目錄,反正都在C:\users\中。文件名為.git-credentials,由於在Window中不允許直接創建以"."開頭的文件,所以需要藉助git bash進行,打開git bash客戶端,進行%HOME%目錄,然後用touch創建文件 .git-credentials, 用vim編輯此文件,輸入內容格式:
touch .git-credentials
vim .git-credentials
https://{username}:{password}@github.com
添加Git Config 內容
進入git bash終端, 輸入如下命令:
git config --global credential.helper store
執行完後查看%HOME%目錄下的.gitconfig文件,會多了一項:
[credential]
helper = store
重新開啟git bash會發現git push時不用再輸入用戶名和密碼
git每次提交都要輸入密碼解決方法三:
在windows中添加一個HOME環境變數,變數名:HOME,變數值:%USERPROFILE%
創建git用戶名和密碼存儲文件
進入%HOME%目錄,新建一個名為"_netrc"的文件,文件中內容格式如下:
machine {git account name}.github.com
login your-usernmae
password your-password
重新打開git bash即可,無需再輸入用戶名和密碼
看過「 git每次提交都要輸入密碼怎麼辦 」的人還看了:
⑺ Windows下,切換git賬號,更改git賬號,git提交時設置用戶名
由於一些情況,借來一台機器編碼,發現git賬戶是他人的,切換後提交代碼,顯示的也是他人設定好的名稱,略顯尷尬。
Windows => 控制面板 => 憑據管理器 => 編輯-重新輸入賬號密碼
修改用戶名和郵箱的命令:
⑻ 最新如何解決git 輸入github時每次都要輸入用戶名和密碼問題
設置記住密碼(默認15分鍾):
git config –global credential.helper cache
如果想自己設置時間,可以這樣做:
git config credential.helper 『cache –timeout=3600』
這樣就設置一個小時之後失效
長期存儲密碼:
git config –global credential.helper store