同步仓库并解决403报错

这时候对本地仓库和github进行同步

# git push -u origin master

error: The requested URL returned error: 403 Forbidden while accessing https://github.com/user/test.git/info/refs

fatal: HTTP request failed

提示403 Forbidden!

打开开关看详细日志

# export GIT_CURL_VERBOSE=1

# git push

* Couldn't find host github.com in the .netrc file; using defaults

* About to connect() to github.com port 443 (#0)

*   Trying 192.30.253.112... * Connected to github.com (192.30.253.112) port 443 (#0)

* Initializing NSS with certpath: sql:/etc/pki/nssdb

*   CAfile: /etc/pki/tls/certs/ca-bundle.crt

CApath: none

* SSL connection using TLS_RSA_WITH_AES_128_CBC_SHA

* Server certificate:

*       subject: CN=github.com,O="GitHub, Inc.",L=San Francisco,ST=California,C=US,postalCode=94107,STREET="88 Colin P Kelly, Jr Street",serialNumber=5157550,incorporationState=Delaware,incorporationCountry=US,businessCategory=Private Organization

*       start date: Mar 10 00:00:00 2016 GMT

*       expire date: May 17 12:00:00 2018 GMT

*       common name: github.com

*       issuer: CN=DigiCert SHA2 Extended Validation Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US

> GET /user/test.git/info/refs?service=git-receive-pack HTTP/1.1

User-Agent: git/1.7.1

Host: github.com

Accept: */*

Pragma: no-cache

* The requested URL returned error: 401 Authorization Required

* Closing connection #0

* Couldn't find host github.com in the .netrc file; using defaults

* About to connect() to github.com port 443 (#0)

*   Trying 192.30.253.112... * Connected to github.com (192.30.253.112) port 443 (#0)

*   CAfile: /etc/pki/tls/certs/ca-bundle.crt

CApath: none

* SSL connection using TLS_RSA_WITH_AES_128_CBC_SHA

* Server certificate:

*       subject: CN=github.com,O="GitHub, Inc.",L=San Francisco,ST=California,C=US,postalCode=94107,STREET="88 Colin P Kelly, Jr Street",serialNumber=5157550,incorporationState=Delaware,incorporationCountry=US,businessCategory=Private Organization

*       start date: Mar 10 00:00:00 2016 GMT

*       expire date: May 17 12:00:00 2018 GMT

*       common name: github.com

*       issuer: CN=DigiCert SHA2 Extended Validation Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US

> GET /user/test.git/info/refs HTTP/1.1

User-Agent: git/1.7.1

Host: github.com

Accept: */*

Pragma: no-cache

* The requested URL returned error: 403 Forbidden

* Closing connection #0

error: The requested URL returned error: 403 Forbidden while accessing https://github.com/user/test.git/info/refs

fatal: HTTP request failed

可以看到上面红色加粗的文字(The requested URL returned error: 401 Authorization Required),是权限问题导致的,可以修改.git/config文件追加用户名和密码:

1)编辑.git/config文件

2)在[remote “origin”]下找到找到url变量

3)修改url = https://github.com/user/test.git,修改为url = ssh://git@github.com/user/test.git,修改完了保存

4)通过git push origin master进行同步,已经可以成功了

git远程提交失败的更多相关文章

  1. Github的使用/git远程提交代码到Github

    Github的使用/git远程提交代码到Github Github是全球最大的社交编程及代码托管网站 Git是一个开源的分布式版本控制系统 1.基本概念 Repository(仓库):仓库用于存放项目 ...

  2. git commit 提交失败

    git commit -m 'xxx' 报错 报错信息 当前分支:master 远程分支:gitlib.xxx error: cannot spawn .git/hooks/commit-msg: N ...

  3. git远程提交到github或者gitee

    一.git安装 git官网下载 https://git-scm.com/downloads ,既有Windows的.Linux的以及Macos的. windowds下载安装git的可执行文件,就会有两 ...

  4. Git远程推送常见错误及解决方案:

    Git远程推送 关注公众号"轻松学编程"了解更多. 1.问题:git远程提交时出现错误: error: RPC failed; curl 56 OpenSSL SSL_read: ...

  5. git本地提交到远程仓库命令

    创建好远程仓库,然后要从本地上传代码到远程仓库: 1.git init 初始化git本地仓库 2. git add 添加到暂存区 3. git commit -am "提交备注" ...

  6. git 本地提交代码到 github 远程库,没有弹框 github login

     git 本地提交代码到 github 远程库,没有弹框 github login:  原因: win10 有个凭据管理器,给保存了历史登陆用户名密码,导致无法切换用户. 解决办法: 删除历史登陆用户 ...

  7. Git push 提交代码到远程global user.name错误解决办法

    问题:安装了Git-1.9.4-preview和TortoiseGit等工具后,Git服务器开通了账号和密码并配置了邮箱.克隆了服务器代码到本地,按需求进行代码开发.提交本地代码到服务器时出现错误.具 ...

  8. 【git】提交代码到远程仓库

    看完不用,就是一个字:忘! 之前学了两天git结果今天要用的时候,啥也想不起来.... 场景: 已有远程仓库: git@192.168.1.1:test/test.git 要提交代码到远程仓库的新分支 ...

  9. GIT 如何合并另一个远程Git仓库的文件到本地仓库里某个指定子文件夹并不丢失远程提交记录?

    问题背景:     最近在重新整理手中的一个项目,目前该项目分为PC项目,手机项目,某第三方接口项目,第三方接口服务项目和手机项目     因为之前规划的原因,原来的四个项目是分两个解决方案来管理的 ...

随机推荐

  1. C#标识符

  2. Dockerfile 编译安装mysql5.7 千万不要执行.只是记录一下编译安装罢了

    开启所有核心make  20G 内存都不够玩,跑3-4个核心吧,还好. 最后的出来的镜像3G多,百思不得其解,看了官方的Dockerfile,也没什么特别,就是 apt 或者 yum.好吧,不知做了什 ...

  3. Java NIO之缓冲区

    1.简介 Java NIO 相关类在 JDK 1.4 中被引入,用于提高 I/O 的效率.Java NIO 包含了很多东西,但核心的东西不外乎 Buffer.Channel 和 Selector.这其 ...

  4. 基础--Redis在Windows环境下的安装

    1. 安装Redis 1.1 下载安装包 https://github.com/ServiceStack/redis-windows#3-run-the-redis-serverexe-using-t ...

  5. SPI知识总结

    SPI知识总结 一.定义 SPI(Serial Peripheral Interface--串行外设接口)总线系统是一种同步串行外设接口,它可以使MCU与各种外围设备以串行方式进行通信以交换信息. 优 ...

  6. 实时Web与WebSocket实践

    引言:实时Web越来越被重视,Google.Facebook等大公司也逐渐开始提供实时性服务.实时Web将是未来最热门的话题之一.  本文选自<基于MVC的JavaScript Web富应用开发 ...

  7. Activiti 实战篇 小试牛刀

    原文地址:http://blog.csdn.net/qq_30739519/article/details/51166062 1:工作流的概念   说明: 1) 假设:这两张图就是华谊兄弟的请假流程图 ...

  8. JavaScript过滤特殊字符

    JavaScript过滤特殊字符 1.设计实例 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ...

  9. 【mongodb系统学习之八】mongodb shell常用操作

    八.mongodb  shell常用基础操作(每个语句后可以加分号,也可以不加,看情况定(有的工具中可以不加),最好是加): 1).进入shell操作界面:mongo,上边已有演示: 2).查看当前使 ...

  10. zTree实现删除树子节点

    zTree实现删除树子节点 1.实现源码 <!DOCTYPE html> <html> <head> <title>zTree实现基本树</tit ...