Git "Fetch URL" and "Push URL", whats the difference?
I am not sure what you mean, since your example includes 2 identical URL, but URLS for push and pull can differ because of:
- protocol issue: see Git protocols: the url will be slightly different because not every protocol supports push operations (http for instance, except in case of smart http)
- intermediate repos: you can push to a different repository which will be the "middle man" between the true "central" repo and yours. Certains operations can then be performed (through a post-receive hook for instance), and the commit will then be pushed to the "actual" remote from there if those operations (like "unit testing", "static code analysis" ...) pass successfully.
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:
It seems to be a common mistake to try using a single remote (e.g. 'origin') to fetch from one place (i.e.
upstream
) while pushing to another (i.e. your publishing point).That will never work satisfactorily, and it is easy to understand why if you think about what
refs/remotes/origin/*
would mean in such a world. It fundamentally cannot reflect the reality.
If it follows the state of your upstream, it cannot match what you have published, and vice versa.The documentation wasn't clear that "
remote.<nick>.pushURL
" and "remote.<nick>.URL
" are there to name the same repository accessed via different transports, not two separate repositories.