在这种情况下,我看到了很多问题,并尝试了那里提供的解决方案,但由于某种原因对我不起作用。
因此,我创建了一个空项目,并使用git init
(documentation)对其进行了初始化。
git remote -v
给了我这个:
origin https://path_to_/my_project.git (fetch)
origin https://path_to_/my_project.git (push)
运行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=origin/<branch> master
当我运行git push origin master时,出现此错误:
error: failed to push some refs to
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.
当我运行git push -f origin master
(如我看到的许多解决方案中所建议)时,出现此错误:
error: src refspec master does not match any.
error: failed to push some refs to 'https://path_to/my_project.git'
其他信息:git branch -r
告诉我:
origin/master
我应检查哪些信息以解决此问题?
答案 0 :(得分:2)
将远程分支设置为本地分支的上游:
git branch -u origin/master
然后拉动
git pull