您的位置:首页 > 编程语言

Git could not resolve the host github.com error/Git push 403 error

2015-08-17 17:29 771 查看
Mac中设置代理上网的方法: http://www.jb51.net/os/MAC/283201.html 错误1:
在同步远程仓库和本地仓库时:
$git remote add origin https://github.com/<username>/<username_repo>.git $git push -u origin master
如果遇到错误:“error: The request URL returned error: 403 Forbidden while accessing https://github.com/<username>/<username_repo>.git” 解决方法:
$git remote set-url origin https://<username>@github.com/<username>/<username_repo>.git #关联资源库地址
然后再执行下面命令就会成功:
$git push -u origin master

错误2:
从远程仓库克隆到本地仓库时:
$git clone https://github.com/<username>/<username_repo>.git 在Mac中如果通过代理无线上网,在Mac terminal中使用git命令时遇到 “could not resolve the host github.com error”的问题
解决方法:
$ set HTTPS_PROXY=http://<login_internet_username>:<login_internet_password>@<proxy>:<port> #设置代理
$ git config --global http.proxy http://<login_internet_username>:<login_internet_password>@<proxy>:<port> #配置git代理
$ sudo git clone https://github.com/<username>/<username_repo>.git
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: