今天在苹果电脑上从GitHub上用IDEA,git到本地一个项目,然后本地修改后,却发现,无法重新push到GitHub上。
git push时遇到了
error: The requested URL returned error: 403 while accessing https: //github.com/username/repo.git/info/refs fatal: HTTP request failed
错误。网上搜索,大部分人都是说修改.git/config
文件
[remote "origin"] url = https://github.com/youname/example.git 为:[remote "origin"] url = https://
youname@github.com/youname/example.git
再次git push,弹出框输入密码(你在github上注册的用户名和密码),即可提交。
这种做法用到了gtk,所以会弹出输入框来输入密码,我的在这里解决了问题。
其他问题
然而我的centos6上没有安装桌面,所以又报出了GTK错误。
另外一种做法是改成ssh://git@github.com/xxxxx
,这种方法需要在github上注册ssh key,否则连不上。
后来发现,这个问题竟然是git的版本落后的问题&#x