服务器每次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 = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = https://gitee.com/xxx/xxance-api.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = 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

已经不需要输入账号密码了。

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐