fatal: The current branch master has no upstream branch.To push the current branch and set the remo

问:

pengIndex % git push
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

To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.

回答:

这个错误提示意味着你的本地"master"分支没有设置远程仓库的上游分支。你可以使用以下命令解决该问题:


git push --set-upstream origin master
```

这将推送当前分支到远程仓库,并将其设置为上游分支。然后,你就可以直接使用`git push`命令来推送更改了。如果你想要自动设置所有没有上游分支的分支,请查阅`push.autoSetupRemote`在`git help config`中的相关信息

你可能感兴趣的:(git)