解决git pull,push 每次操作输入账号密码问题
服务器每次git pull 的时候都需要输入账号密码,一劳永逸解决它。
解决方案:
找到项目下 .git /config 文件,然后打开,编辑
[root@iZbp11b24d3d7nc8uvjx9mZ .git]# ls
branches config description FETCH_HEAD HEAD hooks index info logs objects ORIG_HEAD packed-refs refs
[root@iZbp11b24d3d7nc8uvjx9mZ .git]# pwd
/www/wwwroot/finance-api/.git
[root@iZbp11b24d3d7nc8uvjx9mZ .git]# vim config
打开的文件,大约是这样子的
[core]repositoryformatversion = 0filemode = truebare = falselogallrefupdates = true
[remote "origin"]url = https://gitee.com/xxx/xxance-api.gitfetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]remote = originmerge = refs/heads/master
找到 url =https://gitee.com/xxx/xxnance-api.git,这行
修改成 url = https://{账号}:{密码}@gitee.com/xxx/xxnance-api.git ,格式
修改好大约是这个样子 :
url = https://jack666:123456@gitee.com/xxx/xxnance-api.git
然后保存退出,再次执行 git pull
已经不需要输入账号密码了。