git推送到github报错:error: The requested URL returned error: 403 Forbidden while accessing https://github.com

最近使用git命令从github克隆仓库到版本,然后进行提交到github时报错如下:

[[email protected] git_test]# git push origin master
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/jsonhc/git_test.git/info/refs

fatal: HTTP request failed

解决办法:参考 http://sharadchhetri.com/2014/08/16/error-requested-url-returned-error-403-forbidden-accessing-github-repo/

这台本机没有配置与github的ssh密钥连接,直接通过的是httpds

1、确保不是git版本d低的问题

[[email protected] wadeson]# git --version
git version 1.7.1

2、从github克隆仓库到本地:

git clone https://github.com/jsonhc/git_test.git

[[email protected] wadeson]# git clone https://github.com/jsonhc/git_test.git
Initialized empty Git repository in /home/wadeson/git_test/.git/
remote: Counting objects: 20, done.
remote: Total 20 (delta 0), reused 0 (delta 0), pack-reused 20
Unpacking objects: 100% (20/20), done.

3、查看仓库内容,然后增加需要提交的文件

[[email protected] git_test]# ll
总用量 20
-rw-r--r--. 1 root root 712 7月 31 23:59 flask_first.py
-rw-r--r--. 1 root root 2766 7月 31 23:59 landing.py
-rw-r--r--. 1 root root 1881 7月 31 23:59 menu_list.py
-rw-r--r--. 1 root root 10 7月 31 23:59 README.md
-rw-r--r--. 1 root root 377 7月 31 23:59 total.py

[[email protected] git_test]# mv ../statistics_ip.py ./
[[email protected] git_test]# ll
总用量 24
-rw-r--r--. 1 root root 712 7月 31 23:59 flask_first.py
-rw-r--r--. 1 root root 2766 7月 31 23:59 landing.py
-rw-r--r--. 1 root root 1881 7月 31 23:59 menu_list.py
-rw-r--r--. 1 root root 10 7月 31 23:59 README.md
-rw-r--r--. 1 root root 377 8月 3 15:01 statistics_ip.py

4、git config --global user.name "json_hc"

git config --global user.email "[email protected]"

5、git remote set-url origin https://[email protected]/jsonhc/git_test.git

6、git add statistics_ip.py

git commit -m "add statistics_ip.py to statistics ip of nginx"

[[email protected] git_test]# git commit -m "add statistics_ip.py to statistics ip of nginx"
[master a460f0f] add statistics_ip.py to statistics ip of nginx
1 files changed, 22 insertions(+), 0 deletions(-)
create mode 100644 statistics_ip.py

7、git push -u origin master     第一次推送加上-u

[[email protected] git_test]# git push -u origin master
Password:        这里需要提供github的密码
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 276 bytes, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://[email protected]/jsonhc/git_test.git
8e23043..a460f0f master -> master
Branch master set up to track remote branch master from origin.

然后进入github网站查看已岁推送的文件了

现在使用另外的主机进行开发的时候,首先第一步:

git pull远程仓库的文件

[[email protected] git_test]# git pull origin master
Password:
remote: Counting objects: 2, done.
remote: Total 2 (delta 1), reused 2 (delta 1), pack-reused 0
Unpacking objects: 100% (2/2), done.
From https://github.com/jsonhc/git_test
* branch master -> FETCH_HEAD
Updating 8e23043..a460f0f
Fast-forward
statistics_ip.py | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
create mode 100644 statistics_ip.py
[[email protected] git_test]# ll
total 24
-rw-r--r-- 1 root root 712 Aug 3 14:41 flask_first.py
-rw-r--r-- 1 root root 2766 Aug 3 14:41 landing.py
-rw-r--r-- 1 root root 1881 Aug 3 14:41 menu_list.py
-rw-r--r-- 1 root root 10 Aug 3 14:41 README.md
-rw-r--r-- 1 root root 377 Aug 3 15:24 statistics_ip.py
-rw-r--r-- 1 root root 377 Aug 3 14:41 total.py

这样才能保证不冲突,得到的是新的版本

时间: 2024-11-10 01:27:36

git推送到github报错:error: The requested URL returned error: 403 Forbidden while accessing https://github.com的相关文章

解决git提交问题error: The requested URL returned error: 403 Forbidden while accessing

git提交代码时,出现这个错误"error: The requested URL returned error: 403 Forbidden while accessing https" 解决方法: 编辑.git文件夹下的config文件就可以. vim .git/config #改动对于的配置 #原来的url = https://github.com/elitecodegroovy/PhoenixC.git url = https://[email protected]/elitec

解决git clone时报错:The requested URL returned error: 401 Unauthorized while accessing

版本问题,最直接的解决办法就是重新编辑安装git吧: 1. 下载:# wget -O git.zip https://github.com/git/git/archive/master.zip 2. 解压:# unzip git.zip 3. 进入git目录:# cd git-master 4. 编译安装: autoconf ./configure --prefix=/usr/local make && make install 5. 最后别忘了删掉旧的git,并把新版本的git建立软链接

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

转载自:http://www.uhdesk.com/?p=12 如红色部分所示,clone时候就添加上用户名,随后会提示你输入密码,就OK了 git clone https://[email protected]/blah/blahblah.git 如果你想后面的操作也不再输入密码了,你可以在地址中加上密码 git clone https://username:[email protected]/blah/blahblah.git 如果你已经clone了,也可以通过重设地址的方式 git rem

解决github push错误The requested URL returned error: 403 Forbidden while accessing

来源:http://blog.csdn.net/happyteafriends/article/details/11554043 github push错误: [html] view plaincopyprint? git push error: The requested URL returned error: 403 Forbidden while accessing https://github.com/wangz/future.git/info/refs git version 1.7.

git推送代码Gogs报401错误

1.git push 报错:RPC failed; HTTP 401 curl 22 The requested URL returned error: 401 The remote end hung up 2.原因:用户名和密码输错,导致验证不通过,没有权限推送 3.解决: (1)删除原始远程数据源: git remote rm origin (2)重新添加远程数据源,即在http后面,git前面加上用户名@([email protected]): git remote add origin

使用git提交时报错:error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large

Delta compression using up to 4 threads.Compressing objects: 100% (2364/2364), done.Writing objects: 100% (4329/4329), 1.15 MiB | 11.20 MiB/s, done.Total 4329 (delta 2657), reused 3050 (delta 1497)error: RPC failed; HTTP 413 curl 22 The requested URL

Git上传错误:The requested URL returned error: 403

上传文件的时候出现了The requested URL returned error: 403这个错误 问题描述: 电脑已经注册过一个 github 帐号,一直在本机使用,配置过 SSH. 新建另一个 github 帐号,本地建立好项目之后,使用命令:$ git push -u origin master 时出现以下错误: 问题原因: 问题主要出在原注册账号上,系统保存了账号的信息.在使用新帐号时,信息不一致,所以报错 解决方案: 打开cmd,输入命令:rundll32.exe keymgr.d

git 出现 The requested URL returned error: 403

github push错误 fatal: unable to access 'https://github.com/xuzhenguo/authorize.git/': The requested URL returned error: 403 解决方法: vim .git/config 修改前 [remote "origin"] url = https://github.com/xuzhenguo/authorize.git 修改为: [remote "origin&quo

git使用 User has bean blocked!The requested URL returned error: 403

我用自己电脑上在Coding上创建了一个远程版本库,之后git clone到电脑上,在第一次git push的时候就出现了这个错误: $ git push remote: Coding 提示: User has bean blocked! 用户已被锁定 fatal: unable to access 'https://git.coding.net/yangms/News.git/': The requested URL returned error: 403 之后再提交都是这个错误,删除电脑上的