'git push origin master'中'origin'是什么意思
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5270760/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What's the meaning of 'origin' in 'git push origin master'
提问by Ickhyun Kwon
When I run:
当我运行时:
git push origin master
...what is the meaning of origin
in this context?
...origin
在这种情况下是什么意思?
采纳答案by skuro
origin
is the default name of the remote git repository you cloned from. Have a look at .git/refs/remotes/origin/*
and .git/config
within your sources to see how git knows about it.
origin
是您从中克隆的远程 git 存储库的默认名称。查看.git/refs/remotes/origin/*
并.git/config
在您的来源中查看 git 如何了解它。
回答by Mark Longair
git has a concept of "remotes" - these are like easy nicknames for a repository, so you don't have to use its full URL every time you want to refer to another repository.
git 有一个“远程”的概念——这些就像一个仓库的简单昵称,所以你不必每次想要引用另一个仓库时都使用它的完整 URL。
origin
is just a remote like any other, but you see it very frequently since when you clone a repository for the first time, git clone
will by default set up a remote called origin
to refer to the URL that you cloned from.
origin
与其他任何远程一样,只是一个远程,但您经常看到它,因为当您第一次克隆存储库时,git clone
默认情况下会设置一个远程调用origin
以引用您从中克隆的 URL。
If you do git remote -v
that will show you all the remotes you have set up in your local repository, and the URLs that they refer to. (You'll see that it's a bit more complex than I said above, in that a remote can refer to a different URL for pushing and fetching, but you probably don't need to worry about that. :))
如果您这样做git remote -v
,将向您显示您在本地存储库中设置的所有远程设备,以及它们所引用的 URL。(你会发现它比我上面说的要复杂一些,因为远程可以引用不同的 URL 来进行推送和获取,但你可能不需要担心这一点。:))
回答by livingtech
The origin is where you got the code from origin-ally.
来源是您从origin-ally获得代码的地方。
回答by Deeksha Sharma
This would be help
这会有所帮助
https://www.git-tower.com/learn/git/glossary/origin
https://www.git-tower.com/learn/git/glossary/origin
n Git, "origin" is a shorthand name for the remote repository that a project was originally cloned from. More precisely, it is used instead of that original repository's URL - and thereby makes referencing much easier.
n Git,“origin”是最初克隆项目的远程存储库的简写名称。更准确地说,它被用来代替原始存储库的 URL - 从而使引用变得更加容易。
Note that origin is by no means a "magical" name, but just a standard convention. Although it makes sense to leave this convention untouched, you could perfectly rename it without losing any functionality.
请注意,origin 绝不是一个“神奇”的名字,而只是一个标准约定。尽管保持此约定不变是有意义的,但您可以完美地重命名它而不会丢失任何功能。
In the following example, the URL parameter to the "clone" command becomes the "origin" for the cloned local repository:
在以下示例中,“clone”命令的 URL 参数成为克隆的本地存储库的“来源”:
回答by Nishant Dwivedi
origin is remote created by the git itself when you for the first clone the repo to point the URL from which you created the clone. eg: origin [email protected]:/PROJECT_U
当您第一次克隆存储库以指向创建克隆的 URL 时,源是由 git 本身远程创建的。例如:origin [email protected]:/PROJECT_U
回答by Sameer
"Origin" is the name of the remote repository where you want to publish your commits. By convention, the default remote repository is called "origin," but you can work with several remotes (with different names) at the same time.
“Origin”是您要发布提交的远程存储库的名称。按照惯例,默认远程存储库称为“源”,但您可以同时使用多个远程(具有不同名称)。