I’m getting pretty comfortable with git but I’ve hit something that puzzles me. We use a local mirror, here, because we have a slow line. In order to point at the mirror, I have the usual stuff in .gitconfig.
The problem comes when I want to push. It appears that either I need an alias URL for the repo—not the one remapped in .gitconfig—or I need to edit .gitconfig to push to the real repo (not the mirror).
This really has to be a use pattern. How can I make the mirror seamless on pull and get it out of the way on push?
I have a great workaround for this! Tip of the hat to Matthew McCullough.
It turns out that the GIT_CONFIG env variable has no affect, regardless of what the documentation says. On the other hand, the HOME env variable is the name of the directory in which git looks for .gitconfig. If you define HOME in the git command line, like so:
HOME=~/somewhere git …
… git will obtain its configuration from the .gitconfig is found in the directory “~/somewhere. If that gitconfig does not rewrite URLs to point git at a mirror, you are talking to the origin. You can probably do it in an alias…