在没有 origin master 的情况下进行 git-push
GIT 有没有办法只执行“git Push”,然后自动发送到“origin master”而不指定? 只是好奇...
Is there a way on GIT to just do a "git push" and it automatically send to "origin master" without specify that?
Just curious...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的主分支应该自动设置,这样就可以了。如果您在其他分支上,那么您可以使用带有 --set-upstream 选项的 gitbranch 命令。
在您有一个裸露且干净的情况下,您也可能没有远程集。存储库设置等待您第一次推送到它,例如当您在 github 上设置存储库时。假设您已经设置了遥控器,您可以使用 -u 选项推送到服务器,该选项将为您处理分支 --set-upstream:
这与以下内容相同:
Your master branch should be automatically setup so this works. If you are on some other branch, then you can use the git branch command with the --set-upstream option
It might be also the case that you don't have a remote set, in the case when you have a bare and clean repository setup waiting for you to push to it for the first time, e.g. when you are setting up a repo on github. Assuming you have setup your remote you can push to the server with the -u option that will take care of the branch --set-upstream for you:
which is the same as:
当您处于 master 状态时,
git push
已经执行了git Push origin master
操作。http://www.kernel.org/pub/软件/scm/git/docs/git-push.html
git push
already doesgit push origin master
when you are in master.http://www.kernel.org/pub/software/scm/git/docs/git-push.html
默认行为由push.default配置设置定义。
如果您在 http://git-scm.com/docs/git 上搜索 Push.default -config 你会找到它的各种选项的解释。
The default behaviour is defined by the push.default configuration setting.
If you do a search for push.default on http://git-scm.com/docs/git-config you'll find an explanation for its various options.