同步仓库并解决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. 《android开发艺术探索》读书笔记(六)--Drawable

    接上篇<android开发艺术探索>读书笔记(五)--RemoteViews [BitmapDrawable] 简单的图片 <!xml version="1.0" ...

  2. 中小研发团队架构实践之微服务MSA

    一.MSA简介 1.1.MSA是什么 微服务架构MSA是Microservice Architecture的简称,它是一种架构模式,它提倡将单一应用程序划分成一组小的服务,服务之间互相通讯.互相配合, ...

  3. npm http-server Dockerfile alpine 微容器,袖珍体积,解决时区问题

    前端写得少,但是前端技术的思想也是非常有学习的价值,用VUE写了几个手机form页面,体验了一番spa,用docker部署也是非常简单 直接docker pull node  676M体积.不能忍. ...

  4. 一个简单的Springmvc应用开发例子

            SpringMVC应用的配置步骤:         1,将所有的jar包导入到lib文件夹下:             jar在spring框架包-->libs-->所有的 ...

  5. 【Unity3D】Unity3D 摄像机带透明截图

    转载请注明出处:http://www.cnblogs.com/shamoyuu/p/CropCamera.html ↓↓↓下面的废话可以不看↓↓↓ 最近处理了一批我的游戏的图标,步骤特别繁琐, 需要先 ...

  6. qwe框架- CNN 实现

    CNN实现 概述 我在qwe中有两种,第一种是按照Ng课程中的写法,多层循环嵌套得到每次的"小方格",然后WX+b,这样的做法是最简单,直观.但是效率极其慢.基本跑个10张以内图片 ...

  7. dojo省份地市级联之地市Dao接口类(四)

    dojo省份地市级联之地市Dao接口类 CityDao.java: /** * 地市 */ package com.you.dao; import java.util.List; import com ...

  8. MyEclipse报错

    MyEclipse报错

  9. freemarker自定义标签报错(一)

    freemarker自定义标签 1.错误描述 freemarker.core.ParseException: Token manager error: freemarker.core.TokenMgr ...

  10. javax.el.PropertyNotFoundException:Property 'statisDate' not found on type java.lang.String

    1.错误描述 javax.el.PropertyNotFoundException:Property 'statisDate' not found on type java.lang.String 2 ...