我們如果沒有為項目設置用戶名密碼,那么每次提交都會有提示賬號和密碼輸入:
1.找到你項目的半隱藏文件.git文件夾,通常只要git init 就會生成這樣一個文件夾,現在雙擊進入文件夾:
git config user.name "qianxiao"
2.我們執行如下代碼查看git配置文件:

cat config
windows 直接記事本打開即可
3.顯示如下配置:
顯示如下內容:
[core] repositoryformatversion = 0 filemode = false bare = false logallrefupdates = true symlinks = false ignorecase = true [remote "origin"] url = http://gitee.com/xxx/object.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "room"] remote = origin merge = refs/heads/room [user] name = qianxiao
看到最后一行,成功為當前項目設置了git用戶名
4.然后執行如下代碼新增配置:
git config credential.helper store
5.再執行cat config查看配置:
[core] repositoryformatversion = 0 filemode = false bare = false logallrefupdates = true symlinks = false ignorecase = true [remote "origin"] url = http://gitee.com/xxx/object.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "room"] remote = origin merge = refs/heads/room [user] name = qianxiao [credential] helper = store
看到最后一行新增如上helper;