同步仓库并解决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进行同步,已经可以成功了

最新文章

  1. 在myeclipse文件中如何创建properties类型的文件,从而连接数据库
  2. Sharepoint学习笔记—习题系列--70-573习题解析 -(Q35-Q39)
  3. Mac OS 快捷键
  4. windows中 dll 的解读
  5. Android进阶笔记19:onInterceptTouchEvent、onTouchEvent与onTouch
  6. MJViewController的view的创建
  7. 数学:lucas定理的总结
  8. 201521123001《Java程序设计》第3周学习总结
  9. uva242,Stamps and Envelope Size
  10. 完美解决cannot resolve symbol servlet 的报错
  11. nfs服务启动失败:Failed to start NFS status monitor for NFSv2/3 locking..
  12. 谈谈你对spring的理解?
  13. Python __exit__,__enter__函数with语句的组合应用
  14. Doing Homework HDU - 1074 (状压dp)
  15. JavaScript之DOM概念
  16. AM自动化测试平台
  17. Django框架----分页器(paginator)
  18. 【liunx】Linux下的压缩和解压缩命令——jar
  19. DIV+CSS IE6/IE7/IE8/FF兼容问题汇总
  20. 20180201之Burp Suite Professional V1.7.31 相关英文翻译

热门文章

  1. freemaker中的map遍历
  2. hadoop/storm以及hive/hbase/pig区别整理
  3. python替换脚本
  4. Android内核解读-应用的安装过程
  5. 如何访问pcie整个4k的配置空间
  6. freemarker写select组件(二)
  7. Linux查看内存使用量和交换区使用量
  8. Linux查看目录中的文件
  9. SQL错误:ORA-12899
  10. HTML5图片居中的问题