什么是“原产地”?在Git中? [英] What is "origin" in Git?
问题描述
当我运行时:
git push origin branchname
原因是 origin
,为什么必须在分支名称前输入它?
通过做
git push origin branchname
你说要推送到原点 code>存储库。没有要求命名远程仓库
origin
:事实上,同一个仓库可以为另一个开发人员使用不同的别名。
<远程是一个别名,用于存储存储库的URL。您可以通过使用
git remote -v
在推送
命令中,您可以使用遥控器,也可以直接使用 URL 即可。一个使用URL的例子:
git push git@github.com:git / git.git master
When I run:
git push origin branchname
What exactly is origin
and why do I have to type it before the branch name?
origin
is an alias on your system for a particular remote repository. It's not actually a property of that repository.
By doing
git push origin branchname
you're saying to push to the origin
repository. There's no requirement to name the remote repository origin
: in fact the same repository could have a different alias for another developer.
Remotes are simply an alias that store the URL of repositories. You can see what URL belongs to each remote by using
git remote -v
In the push
command, you can use remotes or you can simply use a URL directly. An example that uses the URL:
git push git@github.com:git/git.git master
这篇关于什么是“原产地”?在Git中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!