当前位置:   article > 正文

git 代码提交,出现403错误的问题_git提交报403

git提交报403

问题原因

使用第一个账号提交时,系统保存了该账号的用户信息。在使用新帐号提交时,与已保存的用户信息不一致,所以报错。

通用解决方案
进入库目录,找到 .git/confog 文件(macOS 可用终端执行 vi .git/config 直接进入修改),参考内容如下:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "origin"]
    url = https://github.com/userName/repositorieName.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "other"]
    remote = origin
    merge = refs/heads/other
将用户名加入 [remote "origin"] 中的 url,最终修改为 url = https://userName@github.com/userName/repositorieName.git,接下来在提交项目时会要求输入密码。此后,系统将保存密码信息,以后这个库的提交将不再要求输入密码,也不会出现 403 错误。
 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/454558
推荐阅读
相关标签
  

闽ICP备14008679号