git設定使用者名稱密碼的示例程式碼
阿新 • • 發佈:2020-07-23
git設定使用者名稱密碼
設定git使用者名稱/郵箱
git config --global user.name [username] git config --global user.email [email]
但是這個僅僅是設定使用者名稱密碼,如果你的git 源每次操作需要你輸入使用者名稱/密碼驗證,你依然需要每次設定,那麼該如何辦呢?
git儲存使用者名稱密碼
這裡主要是配置一個config項
有兩個方法,基本上原理都是一樣,都是修改.git/config檔案
1.使用如下命令,修改config檔案即可儲存
echo "[credential]" >> .git/config echo " helper = store" >> .git/config
2.直接修改.git/config檔案
在linux/mac下可以直接使用vim工具修改config檔案
ubuntu@VM-7-212-ubuntu:~/kernel-code/kernel-netfilter-sample-code$ vim .git/config ##修改成如下 [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = https://github.com/Miss-you/kernel-netfilter-sample-code.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master ##主要是後面這兩行,如果不想儲存,則刪除即可 [credential] helper = store ##儲存
這樣就可以儲存使用者名稱密碼,不用每次都輸入了!
git config檢視配置
使用git config --list檢視已設配置
feiqianyousadeMacBook-Pro:xt_GTPU yousa$ git config --list core.excludesfile=/Users/yousa/.gitignore_global user.name=Miss-you [email protected] core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true core.ignorecase=true core.precomposeunicode=true remote.origin.url=https://github.com/Miss-you/xt_GTPU.git remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* branch.master.remote=origin branch.master.merge=refs/heads/master
到此這篇關於git設定使用者名稱密碼的示例程式碼的文章就介紹到這了,更多相關git 使用者名稱密碼內容請搜尋我們以前的文章或繼續瀏覽下面的相關文章希望大家以後多多支援我們!