[英]how to fix problem pushing new repository on github
I made a new repository on github to display my latest project.我在 github 上新建了一个仓库来展示我的最新项目。 I followed the same steps I have in the past with the one exception of that I checked the box to initalized the repository with a readme.我遵循与过去相同的步骤,唯一的例外是我选中了该框以使用自述文件初始化存储库。 When I try to push my project, I get this error当我尝试推送我的项目时,出现此错误
$ git push -u origin master
To https://github.com/dbrewster42/The-Wall.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/dbrewster42/The-Wall.git'
hint: Updates were rejected because the tip of your current branch is behind
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.
I looked this up and found that it is a common problem, but for people who are updating their repository.我查了一下,发现这是一个常见问题,但对于正在更新存储库的人来说。 I can't find anything about how to fix this problem for a new repository but here are my clumsy attempts我找不到有关如何为新存储库解决此问题的任何信息,但这是我笨拙的尝试
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=<remote>/<branch> master
$ git push -f
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
I also tried to change the origin to another repository without the readme but it says "fatal: remote origin already exists."我还尝试在没有自述文件的情况下将源更改为另一个存储库,但它显示“致命:远程源已经存在”。 Any ideas?有任何想法吗?
Also, these are the steps I follow (the ones that github suggests never worked for me)此外,这些是我遵循的步骤(github 建议的那些对我来说从未奏效)
Just need to add a step that pulls the additional changes of a commit (that adds README) before adding your new commit.在添加新提交之前,只需要添加一个步骤来提取提交的其他更改(即添加自述文件)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.