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. Relative 定位与Absolute 定位实例

    一直没有弄懂相对定位与绝对定位之间的关系,今天特来学习一下.本实践都是在360浏览器下测试所得. <!DOCTYPE html> <html> <head> < ...

  2. linux主机vps简单性能测试

    第一,CPU.内存.硬盘检测 cat /proc/cpuinfo (查看CPU信息) cat /proc/meminfo (查看内存信息) df -lh (查看硬盘信息) 这个命令可以看到我们购买的V ...

  3. 安装LAMP

    1.首先打开命令行,获得最新的软件包 sudo apt-get install update 2.安装MySQL数据库 sudo apt-get install mysql-server mysql- ...

  4. laravel的安装

    安装composer http://docs.phpcomposer.com/download/ curl -sS https://getcomposer.org/installer | php mv ...

  5. STM32F0系列MCU中断向量表的重映射

    最近使用了一款Cortex-M0内核的芯片STM32F030CC,发现它中断向量表的重映射方法与STM32F10x系列的有所区别,在这里记录与分享一下. 由于需要通过IAP进行固件升级,所以芯片的FL ...

  6. Docker centos 安装syslog

    在通常的Linux服务器中,有一些服务本身没有日志,只能通过 tail -f /var/log/messages来查看其运行日志,比如nrpe server.但是,如果想在docker容器中实现这个功 ...

  7. centos6.5 64bit 实现root开机自动登录X桌面

    vim /etc/gdm/custom.conf 修改daemon节点,添加如下内容: AutomaticLoginEnable=true AutomaticLogin=root 重启计算机. 完.

  8. C#:反射

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  9. sharepint 数据视图 添加超链接

    1. 数值域清除数值,输入文本 详细进度 2. 添加连接 到 哪个页面 3. 将inteid拖过来 4. 连接到项目显示表单 5. 直接改下面的连接地址 <a href="http:/ ...

  10. ACM题目————放苹果

    Description 把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法. Input 第一行是测试数据的数目t(0 ...