So this is fairly similar in nature to this old question regarding obtaining all remotes when cloning a repository.
For context, I am required to transfer about 30 projects from an old git forge to a newer, shinier GitLab instance. To make this as transparent as possible for the developers, I was planning on a 2-step approach :
This was my initial approach because we have some external contractors and some old projects lying around, and I was concerned that an overnight shift to the new GitLab would cause more trouble than it's worth...
Only now did I realise that changes to the remote urls are only local. This would mean that to implement step 1 of my plan, every dev would have to run git remote --set-url --add --push origin git@xxxxx:repo.git
for every project, which would be a nightmare as some would inevitably slip through the cracks. I initially thought that adding an URL to the remote would add it to the repo's config, which would then be updated on every other dev's local copy.
My question is in two parts - Firstly, is there still no way to this day to make it so that changes to the remote configuration are spread to all users when they next clone/fetch a project? And if not, how could I set up this transition to the new remote smoothly?
I feel like I may not be going at this the right way. In any case, asking 20ish developers to run a command on 30 projects each is not gonna fly.
give them time to set up SSH keys
If you have access to the old account database, batch pre-create users and import keys from the old system.
is there still no way to this day to make it so that changes to the remote configuration are spread to all users when they next clone/fetch a project?
No, probably even deliberately so (if I had to guess). The HTTP client code honors temporary redirects but SSH doesn't, likely because an SSH connection could have more security impact (e.g. implicitly revealing user's default public keys, which could be different than the key configured for the Git host).
every dev would have to run git remote --set-url --add --push origin git@xxxxx:repo.git for every project
Have them run a git config
that adds an insteadOf alias.
git config --global url."git@newhost:".insteadOf "git@oldhost:"
(Any prefix works, e.g. git@oldhost:myorg/
if it was a specific organization's repos.)