要推送当前分支并将远程设置为上游,请使用 git push --set-upstream origin master

To push the current branch and set the remote as upstream, use git push --set-upstream origin master

我是 git bash 的初学者,但是当我执行 git push 时,我无法找到错误的含义,我得到了错误

To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master

直到 git commit 一切正常,我在 git status 命令中得到了所有东西但是在 git push 之后一切似乎都丢失了。

屏幕截图供参考:

To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master

当您使用 git push 时,这意味着您正在尝试将本地存储库上传到在线托管的远程存储库,它可能是 github、gitlab 等.

为了将您的代码上传到远程存储库,您需要设置一个上游,这意味着设置一个位置来推送您的存储库。 您可以通过添加远程存储库的 URL 来做到这一点。

git remote add origin url-of-remote #origin becomes the shorthand for the url

完成此操作后,您可以使用 git push -u origin master

轻松推送代码