遇到问题:Pushing to Git returning Error Code 403 fatal: HTTP request failed

Github 似乎只支持 ssh 方式来读写 repo,尽管 https 方式也显示了“读写”。

您需要将 PC 上的 repo 配置更改为 ssh 方式:

  1. edit .git/config file under your repo directory
  2. find url=entry under section [remote "origin"]
  3. change it from url=https://MichaelDrogalis@github.com/derekerdmann/lunch_call.git to url=git@github.com/derekerdmann/lunch_call.git. that is, change all the texts before @ symbol to ssh://git
  4. Save config file and quit. now you could use git push origin master to sync your repo on GitHub

注意前提是你的机器已经生成了github邮箱账号的SSH密钥,并已经设置到github setting里面.

下面是设置SSH密钥.

检查现有 SSH 密钥

在生成 SSH 密钥之前,您可以检查是否有任何现有的 SSH 密钥

  1. 打开 Terminal(终端)。

  2. Enter ls -al ~/.ssh to see if existing SSH keys are present.

    $ ls -al ~/.ssh
    # Lists the files in your .ssh directory, if they exist
  3. 检查目录列表以查看是否已经有 SSH 公钥。 By default, the filenames of supported public keys for GitHub are one of the following.

    • id_rsa.pub
    • id_ecdsa.pub
    • id_ed25519.pub

如果您还没有 SSH 密钥,则必须生成新 SSH 密钥用于身份验证。 如果不确定是否已经拥有 SSH 密钥,您可以检查现有密钥。 更多信息请参阅“检查现有 SSH 密钥”。

  1. 打开 Terminal(终端)。

  2. 粘贴下面的文本(替换为您的 GitHub 电子邮件地址)。

    $ ssh-keygen -t ed25519 -C "your_email@example.com"

这将以提供的电子邮件地址为标签创建新 SSH 密钥。

> Generating public/private algorithm key pair.
  1. 提示您“Enter a file in which to save the key(输入要保存密钥的文件)”时,按 Enter 键。 这将接受默认文件位置。

    > Enter a file in which to save the key (/home/you/.ssh/algorithm): [Press enter]
  2. 在提示时输入安全密码。 更多信息请参阅“使用 SSH 密钥密码”。

    > Enter passphrase (empty for no passphrase): [Type a passphrase]
    > Enter same passphrase again: [Type passphrase again]

将 SSH 密钥添加到 ssh-agent

在向 ssh 代理添加新的 SSH 密钥以管理您的密钥之前,您应该检查现有 SSH 密钥并生成新的 SSH 密钥。

  1. 在后台启动 ssh 代理。

    $ eval "$(ssh-agent -s)"
    > Agent pid 59566

    根据您的环境,您可能需要使用不同的命令。 例如,您可能需要在启动 ssh 代理之前运行 sudo-s-H 来使用根访问,或者您可能需要使用 exec ssh-agent bash 或 exec ssh-agent zsh 来运行 ssh-agent。

  2. 将 SSH 私钥添加到 ssh-agent。 如果您创建了不同名称的密钥,或者您要添加不同名称的现有密钥,请将命令中的 id_ed25519 替换为您的私钥文件的名称。

    $ ssh-add ~/.ssh/id_ed25519

新增SSH密钥到Github

新增 SSH 密钥到 GitHub 帐户 - GitHub Docshttps://docs.github.com/cn/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account

git push 到github配置(问题Pushing to Git returning Error Code 403 fatal: HTTP request failed)相关推荐

  1. git push到GitHub的时候遇到! [rejected] master -> master (non-fast-forward)的问题

    git push到GitHub的时候遇到! [rejected] master -> master (non-fast-forward)的问题 解决方法: 1.git pull origin m ...

  2. git clone出现fatal: HTTP request failed --git版本问题

    当git版本低于2.0版本时,在push或clone代码时容易出现"fatal: HTTP request failed"的问题. 当前,git的最新版本是2.33.1.但是,当我 ...

  3. Git(2)-- Git安装后首次配置与第一次使用Git和Github管理自己的代码(超详细纯小白图文教程)

    文章目录 0.写在前面: 一.注册Github 1.注册Github: 2.登录 3.创建仓库 二.安装Git 三.配置Git和Github(Git安装好后首次使用需要配置完成后才可以使用) 1.打开 ...

  4. git push 到github时,报错:ERROR: Permission to xxx.git denied to sb.

    从github上新clone一个项目,修改后,push新代码,报错如下: ERROR: Permission to xxx.git denied to sb. fatal: Could not rea ...

  5. mac git安装及github配置

    准备下载一个react的demo程序包,需要本地用到git.早就向配置了,那就安装配置一下吧. 首先,原来mac已经安装了git,版本 2.7 ,我用 brew又安装了一份git 版本 2.10.2. ...

  6. windows中使用Git工具连接GitHub(配置篇)

    备注:摘抄自:http://www.cnblogs.com/sorex/archive/2011/08/10/2132359.html Git在源码管理领域目前占很大的比重了,而且开源的项目很多都转到 ...

  7. git安装及github配置

    一.git安装 二.github连接 1.账户信息配置 用户名: git config --global user.name "username" 邮箱 git config -- ...

  8. Git 针对 GitLab Github 配置 HTTP HTTPS SSH 代理

    文章目录 配置 git 代理 配置 git 的 http https 代理 配置 git 的 ssh 代理 配置 git 代理 配置 git 的 http https 代理 Linux 和 Windo ...

  9. git push到GitHub的时候遇到! [rejected] master - master (non-fast-forward)的问题

    名为的manage项目操作过程 1.在manage文件夹里打开git,输入git init初始化本地仓库,GitHub创建远程仓库manage 2.以下命令关联本地和远程仓库,*****为我的用户名 ...

  10. 前端学习(1854)vue之电商管理系统电商系统之git push后出现错误 ![rejected] master -> master(non-fast-forward) error:failed t

    ! [rejected]        master -> master (non-fast-forward) error: failed to push some refs to 'https ...

最新文章

  1. python argsort排序结果_numpy.argsort()可以对元组或列表进行排序
  2. 网站排名在首位后,为什么还要继续做SEO?
  3. layui 上传图片校验
  4. 计算机系统组成图表,Excel2013中的图表作用组成类型与认识(上)——想象力电脑应用...
  5. Java工程师该如何编写高效代码?
  6. CPU占用率是什么?
  7. ipsec_profile
  8. android代码跳过锁屏,Android_android禁止锁屏保持常亮(示例代码),在播放video的时候在mediaplayer m - phpStudy...
  9. angular2系列之动画-路由转场动画
  10. 什么是REST架构 - z
  11. python中for和while区别_Python的while 1跟while True到底有什么区别?
  12. 通信系统仿真原理与无线应用笔记-MATLAB
  13. 20162327WJH第一次实验——线性结构
  14. matlab画倾斜的椭球_用matlab绘制椭球体x^2/4+y^2/9+z^2/16=1,并通过改变观察点获得它在各个坐标面上的投影。...
  15. 使用nfsstat命令查看NFS服务器状态
  16. checkbox 选中_山西男篮热身赛两胜江苏 张宁首秀表现不俗 为什么会选中他?
  17. apple configurator 2 获取appstore ipa包
  18. 云信DUILIB 常用控件 小实例
  19. 搭建系统|升级选股工具,多板块个股同时提取!个股行情走势存入数据库
  20. 创新型中小企业认定条件有哪些?

热门文章

  1. 谷歌约束控件(ConstraintLayout)扁平化布局入门
  2. 福晶科技与九章量子计算机,量子计算机“九章”横空出世,还要光刻机吗?12月3日,中国量子计算机“九章”横空...
  3. linux文件移出目录命令_Linux移动文件命令F01
  4. ts的小demo--贪吃蛇(尚硅谷教程笔记)
  5. 一夜上手uni-app
  6. Express框架学习笔记-post请求参数的获取
  7. 如何快速清空一个文件内容
  8. 数据抽取oracle_【跟我学】特征抽取算法与应用
  9. java常见抛出异常
  10. java期末考试工程项目_java web 期末项目实验源码20套,自用学习非常不错!