【问题标题】:git push origin master non-fast-forwardgit push origin master 非快进
【发布时间】:2018-09-30 13:14:23
【问题描述】:

我完成了使用命令行将现有项目添加到 GitHub 时给出的过程:
1. 更改目录
2. git初始化
3. git add .
4. git commit -m "第一次提交"
5. git远程添加源https://github.com/fitz00/Mega-Grazio.git
6.git远程-v

但是每当我运行最终命令时;

7. git push origin master

我总是收到这个错误:->

fatal: HttpRequestException encountered.
An error occurred while sending the request.
Username for 'https://github.com': fitz00
To https://github.com/fitz00/Mega-Grazio.git
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/fitz00/Mega-Grazio.git'
hint: Updates were rejected because the tip of your current branch is behind<br>
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

在存储库中,有两 (2) 个自动生成的文件 LICENSE 和 ReadMe.md。
请问如何绕过这个错误?

【问题讨论】:

标签: git github


【解决方案1】:

试试下面的

 git push -u origin master

编辑

我看到了您的存储库。它已经有一些内容,并且您在推送之前从未提取过该信息。 你能做的是

git clone https://github.com/fitz00/Mega-Grazio.git
cd Mega-Grazio

然后添加新内容并提交/推送

【讨论】:

  • @Brendan 您是否尝试过首先完全删除本地存储库,然后仅在此答案中运行 git clone 命令?
猜你喜欢
  • 2012-02-15
  • 1970-01-01
  • 1970-01-01
  • 2021-04-13
  • 2012-09-09
  • 2015-12-08
  • 2017-09-21
  • 2011-08-07
  • 2021-07-14
相关资源
最近更新 更多