git push origin master非快进

时间:2018-04-19 22:29:04

标签: git github

我使用命令行完成了向GitHub添加现有项目时给出的步骤:
1.更改目录
2. git init
3. git add。
4. git commit -m"首次提交"
5. git remote add origin https://github.com/fitz00/Mega-Grazio.git
6. git remote -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 请问我该如何绕过这个错误?

1 个答案:

答案 0 :(得分:0)

尝试以下

 git push -u origin master

修改

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

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

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