git 无法提交报错 - error: The requested URL returned error: 403 Forbidden while accessing https://github.c

git clone 下来的时候,执行

git push origin master

的时候报错:

error: The requested URL returned error: 403 Forbidden while accessing https://github.com


修复方式

vi .git/config
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = https://github.com/fancyecommerce/yii2-fec.git

改成

[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = https://[email protected]/fancyecommerce/yii2-fec.git

继续执行

git push origin master 

报错:

Gtk-WARNING **: cannot open display:

执行:

unset SSH_ASKPASS


继续执行git push origin master 

[root@services fec]# git push origin master
Password: 
Counting objects: 503, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (485/485), done.
Writing objects: 100% (498/498), 1.67 MiB | 255 KiB/s, done.
Total 498 (delta 130), reused 2 (delta 0)
To https://[email protected]/fancyecommerce/yii2-fec.git
   936020b..07260aa  master -> master

成功


你可能感兴趣的:(Git)