Git:初始化了一个空存储库,但无法推送或拉送
在这种情况下,我看到了许多问题,并尝试了那里提供的解决方案,但由于某种原因,这些解决方案对我不起作用 因此,我创建了一个空项目,并使用Git:初始化了一个空存储库,但无法推送或拉送,git,Git,在这种情况下,我看到了许多问题,并尝试了那里提供的解决方案,但由于某种原因,这些解决方案对我不起作用 因此,我创建了一个空项目,并使用gitinit()初始化了它 git-remote-v告诉我: origin https://path_to_/my_project.git (fetch) origin https://path_to_/my_project.git (push) origin/master 当我运行git pull时,我得到以下错误: There is no tra
gitinit
()初始化了它
git-remote-v
告诉我:
origin https://path_to_/my_project.git (fetch)
origin https://path_to_/my_project.git (push)
origin/master
当我运行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
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.
error: src refspec master does not match any.
error: failed to push some refs to 'https://path_to/my_project.git'
当我运行git push-f origin master时(正如我看到的许多解决方案中所建议的那样),我会遇到以下错误:
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
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.
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 https://path_to_/my_project.git (fetch)
origin https://path_to_/my_project.git (push)
origin/master
要解决此问题,我应该检查哪些信息?将远程分支设置为本地分支的上游:
git branch -u origin/master
然后拉
git pull
将远程分支设置为本地分支的上游:
git branch -u origin/master
然后拉
git pull
可能的重复可能的重复