Git clone 成功 git push 却 403错误 解决方案

解决方法

 1.在代码的.git/config文件内[remote “origin”]的url的gitlab域名前添加gitlab注册时的“用户名:密码@”
 2.这个用户要在对应项目下的角色是Owner或Master才行,如果是Guest、Reporter、Developer,则如下操作后也是不行。

操作

 vim .git/config

[chengyuxuan@dmp01 ~/GitDown/K-V-]$ cat .git/config 
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = https://用户名:密码@github.com/sdoyuxuan/K-V-.git
[branch "master"]
        remote = origin
        merge = refs/heads/master

 操作完毕后就可以git push 了。

你可能感兴趣的:(编程心得)