gp报错fatal: unable to access ‘https://github.com/XXX.git/‘: The requested URL returned error:403

在网上看了些方法,最后找到了解决办法
修改git的config文件

vim .git/config

输入i,打开vim编辑模式

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
[remote "origin"]
        url = https://github.com/overmindgc/GCFunnelChart.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master

修改url,在host前边加上你的github账号密码,用:和@分开

url = https://username:[email protected]/overmindgc/GCFunnelChart.git

然后ctrl+c退出vim命令,输入:x退出。

之后继续执行正常的git push -u origin main 命令就可以了

你可能感兴趣的:(github,git报错)