Git“获取 URL”和“推送 URL”有什么区别?
对于某个远程,什么时候 Fetch URL 和 Push URL 会不相同?
例如,当我为名为central的远程运行git remote showcentral
时,输出如下所示:
* remote central
Fetch URL: [email protected]:/home/aoberoi/Repositories/example.git
Push URL: [email protected]:/home/aoberoi/Repositories/example.git
HEAD branch: master
Remote branch:
master tracked
我只是不明白为什么我会从两个不同的URL中获取和推送到两个不同的URL,什么类型的工作流程的用途是什么?
When would the Fetch URL and Push URL not be the same for a certain remote?
For example, when i run git remote show central
for a remote named central, the output looks like:
* remote central
Fetch URL: [email protected]:/home/aoberoi/Repositories/example.git
Push URL: [email protected]:/home/aoberoi/Repositories/example.git
HEAD branch: master
Remote branch:
master tracked
I just don't see why I would be fetching from and pushing to two different URLs, what type of workflow is this intended for?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定您的意思,因为您的示例包含 2 个相同 URL,但推送和拉取的 URL 可能不同,因为:
有关此类用法的示例,请参阅:
“< strong>您见过的源存储库最巧妙的用法是什么?”。
话虽这么说,提交 697f652(Git 2.3.1+,2015 年第一季度/第二季度) Git 维护者 Junio C Hamano (
gitster
) 提到:I am not sure what you mean, since your example includes 2 identical URL, but URLS for push and pull can differ because of:
For instance of such a usage, see:
"What is the cleverest use of source repository that you have ever seen?".
That being said, commit 697f652 (Git 2.3.1+, Q1/Q2 2015) by Git maintainer Junio C Hamano (
gitster
) do mention:我认为,如果您想要一个“暂存”存储库贡献者会推送到的存储库,然后其他人会在审核和批准后将更改从那里推送到主存储库,那么您可以使用它。因此,您可以从主存储库中获取数据,然后推送到临时存储库。
I think you could use it if you wanted a "staging" repo contributors would push to, and then others would push changes from there to the main repo after review and approval. So you'd fetch from the main repo, and push to the staging repo.