git設(shè)置用戶名密碼的示例代碼
git設(shè)置用戶名密碼
設(shè)置git用戶名/郵箱
git config --global user.name [username] git config --global user.email [email]
但是這個僅僅是設(shè)置用戶名密碼,如果你的git 源每次操作需要你輸入用戶名/密碼驗證,你依然需要每次設(shè)置,那么該如何辦呢?
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查看已設(shè)配置
feiqianyousadeMacBook-Pro:xt_GTPU yousa$ git config --list core.excludesfile=/Users/yousa/.gitignore_global user.name=Miss-you user.email=snowfly1993@gmail.com 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
到此這篇關(guān)于git設(shè)置用戶名密碼的示例代碼的文章就介紹到這了,更多相關(guān)git 用戶名密碼內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
30個提高Web程序執(zhí)行效率的好經(jīng)驗分享
30個提高Web程序執(zhí)行效率的好經(jīng)驗分享,需要的朋友可以參考下。2011-10-10TCP協(xié)議詳解_動力節(jié)點Java學院整理
本文描述了TCP協(xié)議,首先簡單介紹了TCP完成了一些什么功能;介紹了TCP報文格式,以及典型報文的數(shù)據(jù)格式?,F(xiàn)在通過本文給大家詳細介紹,感興趣的的朋友一起看看吧2017-07-07chatGPT使用及注冊過程中常見的一些錯誤解決方法(所有報錯匯總)
這篇文章主要介紹了chatGPT注冊報錯及使用過程中報錯匯總及解決方法,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2023-02-02