I'm pretty sure I know the answer to this, can I "preset" (i.e., commit) a remote to a Git repository so that when it is cloned, the cloned repository also has the remote without having to remote add
it?
Here's the use case. I want to fork node and make changes that only my team needs (i.e., that would be inappropriate to merge back into the upstream repository). I also want my team to be able to periodically merge new changes from the original repository. In other words:
- On github.com: fork github.com/joyent/node → github.com/[me]/node
- On my local machine:
git clone https://github.com/[me]/node.git
- On my local machine:
git add remote upstream https://github.com/joyent/node.git
- [
branch
, hack,merge
,fetch upstream
,push
, etc.]...
So far so good.
What I really want is to "commit" and "push" the upstream
remote configuration so the next time someone does git clone https://github.com/[me]/node.git
, they don't have to also do git add remote upstream https://github.com/joyent/node.git
(i.e., it's already set for the cloned repository).
I see that git
has a specialized notion of being able to commit submodule configurations (see gitmodules[5]
), but I can't find a generic option for arbitrary configuration overrides. I realize this is probably by design, since it risks misuse (imagine a preset override of user.email
).
Any help is appreciated, even if it's just: "Nope, sorry. Your team is going to have to type git add remote upstream ...
for every cloned repo. [Citation.]"