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. [sinatra] Just Do It: Learn Sinatra, Part One Darren Jones

    1. Install sinatra gem gem install sinatra --no-ri --no-rdoc 2. Basic App #!/usr/bin/ruby require 's ...

  2. sql server 数据库模型 备份 恢复 总结 备份脚本

    事务日志是可以基于时间点恢复的,必须在full或bulk_logged模式下 Alter database [DBName] set recover bulk_logged , then the fo ...

  3. android 项目学习随笔十八(三级缓存)

    xUtils的BitmapUtils模块用的就是三级缓存,在项目中尽量还是应用BitmapUtils 三级缓存(机制) import com.itheima.zhsh66.R; import andr ...

  4. [转]Using the Group Pane to Repeat Page Titles

    转自:http://www.wiseowl.co.uk/blog/s148/group-pane-advanced-mode.htm Repeating Page Headers in Reporti ...

  5. Caused by: javax.xml.bind.JAXBException: standardPremiumUpdateMessageDTO is not a valid property on

    Caused by: javax.xml.bind.JAXBException:  standardPremiumUpdateMessageDTO is not a valid property on ...

  6. Wall Street English

    1月23号,报名Wall Street English!

  7. 【PHP设计模式 07_ZeRenLian.php】责任链模式

    <?php /** * [责任链模式] * 情景设置:根据不同的需求,去找相应级别的责任人解决问题 */ header("Content-type: text/html; charse ...

  8. C#:向控件添加信息类

    using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; names ...

  9. Ecshop后台订单列表增加”商品名”检索字段

    近期ecshop网站做活动,统计商品订单量的时候没有按商品名搜索的选项,只能手动查询.这样效率很低下,而且容易出错. 现在为列表增加一个简单的“按商品名搜索”表单项.效果如下图 涉及到2个文件,分别是 ...

  10. oracle 执行执行动态存储过程名---其实就是存储过程名是个字符串参数

    假设我有一个过程P1(V1 IN VARCHAR2),另一有一个过程EX(P IN VARCHAR2,P IN VARCHAR2),第一个参数是过程名,第二个参数是指定过程的参数,我执行EX('P1' ...