Reputation: 1040
I want to create multiple repositories inside one repository. These will be recursive. I already have a code of having 80-90 repositories. But i need to change the "origin" of each repository. So, i have two questions-
How can i create git repositories recursively?
(If .git is already present How can i change the "origin" of each repository?
Any help will be highly appreciated.
Upvotes: 1
Views: 218
Reputation: 1324937
Note: using submodule would mean:
you declare those repos as submodule, which means you are using the appropriate origin url when typing git submodule add
:
cd /path/to/main/repo
git submodule add /url/to/submodule/repo
Then:
git submodule update --recursive --init
No need to change their origin
after that.
That being said, if you still had to change their url, then, as commented by keltar:
git submodule foreach 'git remote set-url origin newremote.com:/path/to/git/dir/$path'
Upvotes: 1
Reputation: 179452
If you want to manage a bunch of repositories from a single repo, I suggest perhaps looking at the repo
tool. Android uses this to manage the 100+ repositories that make up the Android Open Source Platform.
Upvotes: 0