做没有起源大师的git-push [英] Doing git-push without origin master

查看:143
本文介绍了做没有起源大师的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...

推荐答案

您的主分支应该自动设置,这样可以工作。如果你在其他分支上,那么你可以使用带有--set-upstream选项的git branch命令

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

git branch --set-upstream someBranch origin/master

也可能是您没有的情况一个远程设置,当你有一个简单而干净的存储库设置等着你第一次推送它时,例如当你在github上设置回购时。假设你已经设置了你的远程服务器,你可以使用-u选项来推送到服务器,该选项将负责为你设置分支--set-upstream:

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:

git push -u origin master

它与

git push origin master
git branch --set-upstream master origin/master

这篇关于做没有起源大师的git-push的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆