我使用github的时间相对较短,我总是使用客户端来执行提交和拉取。昨天我决定从git bash中尝试一下,我成功地创建了一个新的repo和提交文件。

今天我从另一台计算机上对存储库进行了更改,我已经提交了更改,现在我回到了家,并执行了git拉来更新我的本地版本,我得到了这个:

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 develop origin/<branch>

这个回购的唯一贡献者是我,没有分支(只有一个主)。我在窗口上,我已经执行了从git bash的拉:

git 状态:

$ git status
# On branch master
nothing to commit, working directory clean

git 分支:

$ git branch
* master

我做错了什么?


当前回答

1) git branch——set-upstream-to=origin/<master_branch> feature/<your_current_branch>

2) git拉

其他回答

试着用

git push --set-upstream origin <branch_name>

否则

use

git push -u 

会告诉你该怎么做。

看:git签出标签,git拉失败在分支

如果你像我一样需要一直这样做,你可以通过在你的.gitconfig文件中添加以下内容来设置一个别名来自动完成:

[alias]
    set-upstream = \
       !git branch \
           --set-upstream-to=origin/`git symbolic-ref --short HEAD`

当你看到这个消息没有跟踪信息…运行:

 git set-upstream
 git push

感谢https://zarino.co.uk/post/git-set-upstream/

同样的事情也发生在我之前,当我创建了一个新的git分支,而没有把它推到原点。

试着先执行这两行:

git checkout -b name_of_new_branch # create the new branch
git push origin name_of_new_branch # push the branch to github

然后:

git pull origin name_of_new_branch

现在应该没事了!

Git分支——set-upstream-to=origin/main

这个答案是最好的

谁希望将他们的回购链接到他们的项目并提交更改

作为椰子的答案

步骤1

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

步骤2

git branch -u origin/master
Branch 'master' set up to track remote branch 'master' from 'origin'.

步骤3

git pull
Already up to date.

这个问题

我花了几个小时提交更改 我遵循了上面的步骤 和 Git添加。Git提交。 然后我执行下面的步骤,我的推动是成功的

推动变革

执行

git push -f origin master