1. 在github上新建一个空项目。

2. git clone 到本地仓库。

3. git add [一些文件]。

4. git commit -m "first commit"。

5. git remote add origin https://github.com/your name/your project.git。

6. git push -u origin master。报错如下:

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

fatal: HTTP request failed

7. 解决办法:

. vim .git/config (编辑这个项目仓库目录下的config文件)。
. 找到[remote "origin"]域。
. 把url = https://xxx@github.com...
修改为
url = ssh://git@github.com...
. 保存并退出。

8. 执行git push -u origin master,成功。

PS:知其然,但是我并不知其所以然。

纯推测:

① 开始用https提交的方式没有通过服务器身份验证。

② 改为ssh提交的方式通过了服务器的身份验证(因为我本机生成了ssh key并在github登记过)。

如果这个推测有问题,还望有高手指正,谢谢。

git push 403的更多相关文章

  1. coding git push 403 时

    直接修改 项目目录下的 .git/config   url url = https://coding用户名:coding密码@git.coding.net/coding账号/coding项目名称.gi ...

  2. git push上传代码到gitlab上,报错401或403

    之前部署的gitlab代码托管平台,采用ssh方式连接gitlab,在客户机上产生公钥上传到gitlab的SSH-Keys里,则git clone下载和git push上传都没问题,这种方式很安全. ...

  3. “git push”后返回“Error 403”解决方法

    问题描述: 1,mac ox系统,terminal上运行命令git push出现403错误: 2,代码是在别人的github(暂且叫origin branch吧)上克隆的,修改和添加了部分代码后欲提交 ...

  4. git push上传代码到gitlab上,报错401/403(或需要输入用户名和密码)

    之前部署的gitlab,采用ssh方式连接gitlab,在客户机上产生公钥上传到gitlab的SSH-Keys里,git clone下载和git push上传都没问题,这种方式很安全. 后来应开发同事 ...

  5. Git系列 —— 记一次Mac上git push时总是403的错误

    问题: 今天从github上clone下一个项目,然后修改后git push时总是出现: remote:Permission to lixyou/rw-split-plugin.git defined ...

  6. git push The requested URL returned error: 403 Forbidden while accessing

    错误提示信息: error: The requested URL returned error: Forbidden while accessing https://github.com/xingfu ...

  7. GitHub 在使用命令行 git push 时报错:The requested URL returned error: 403

    使用 git 的命令行向 GitHub 提交的时候,报错: [Young@localhost OtherLang]$ git push origin master error: The request ...

  8. git push错误解决方案

    错误提示: error: The requested URL returned error: 403 Forbidden while accessing https://nanfei9330@gith ...

  9. github多用户git push错误remote: Permission to user1/z.git denied to user2

    背景:同一台电脑的public key同时添加到了github的两个账户,导致user1的仓库没法正常提交. 解决办法:为两个账户分别配置ssh key,配置~/.ssh/config文件(windo ...

随机推荐

  1. 帮初学者改代码——playerc之“练习:求完数问题”(下)

    前文链接:帮初学者改代码——playerc之“练习:求完数问题”(上) 再来看看be_ferfect()应该如何改. be_ferfect()函数的功能是判断number是否为完数,同时把因子对写入d ...

  2. TortoiseGit文件夹和文件图标不显示解决方法

    试了两种方法, 1.修改Max Cached Icons http://www.open-open.com/lib/view/open1414396787325.html 2.修改图标排序 http: ...

  3. Sublime怎样新建HTML文档

    1.在右下角有个plain text的标志,点击,选择文件类型为HTML 2.保存为HTML文档 3.这时候输入"!"(注意一定要选择对输入法) 4.然后按"Tab&qu ...

  4. Notepad++编辑Pyhton文件的自动缩进的问题(图文)

    转自:http://www.xuebuyuan.com/1102224.html 这个问题一直困扰我很久,Python对缩进很敏感,一般建议缩进用空格,而 Notepad++的自动缩进是用的TAB,g ...

  5. VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装

    VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装在阿里云开源镜像地址下载镜像Index of /centos/7.2.1511/isos/x86_64/http://mirro ...

  6. Spring+Mybatis+jQuery.Pagination.js异步分页及JsonConfig的使用

    在开发工作中经常用到异步分页,这里简单整理一下资料. 一.Controller方法 package com.lwj.controller; import javax.servlet.http.Http ...

  7. 在MyEclipse中搭建Spring MVC开发环境

    环境版本 IDE:MyEclipse 8.5 Spring:spring 3.2.8 JDK:1.6 1.打开MyEclipse-->File-->New-->Web Project ...

  8. java面试每日一题5

    题目:企业发放的奖金根据利润提成.利润(I)低于或等于10万元时,奖金可提10%:利润高于10万元,低于20万元时,低于10万元的部分按10%提 成,高于10万元的部分,可可提成7.5%:20万到40 ...

  9. 杭电1003-Max Sum

    Max Sum Problem Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the ...

  10. jqeury之轮播图

    $(document).ready(function(){ var sWidth = $('#pic1').width(); var len = $('#pic1 .sildebar li').len ...