- The list of git repositories to clone is read from the config file (
repos-manager-config.jsonby default, can be changed) from therepositoriesfield. - All git repositories are cloned into the specified folder (
src/reposby default, can be changed) - Before cloning a repo, the local folder with this repo is deleted if it exists.
- If a repository has unsaved changes, it is skipped so you won't lose any changes
If you're on mac, you can just use already compiled
build/repos-managerfile from this repo. If you're not on mac:
- Clone this repo
- Install go
- Run
go build -o build/repos-mangerinside the cloned repo to generate a compiled file for your operating system (instead ofrepo-manageryou can use any filename)
- Copy the
repos-managerfile that contains the app frombuilddirectory to the place where you want to manage multiple git repositories. - Copy
.envfile from this repository to the same place. It contains the environment variables required for the app to run. - You can change any environment variables you want in
.env+ the app also reads a file.env.local !Important!If you're cloning git repositories with ssh - set the path to your ssh key in the env config file.- Create
repos-manager-config.jsonwith the list of your git repositories (an example of the config file is available few headers below) - Run the app to clone all your git repositories:
./repos-manager
repos-manager
repos-manager-config.json
.env
.env.local (optional)
CONFIG_FILE="repos-manager-config.json"
REPOS_DIR="src/repos"
SSH_KEY_PATH="/Users/your_username/.ssh/id_rsa"
SSH_KEY_PASSWORD=""CONFIG_FILE - the name of the JSON file from which the list of git repositories to clone is read. Inside, the field repositories is used
REPOS_DIR - relative path to the directory to which git repositories will be cloned. Don't forget to add it to .gitignore
SSH_KEY_PATH - absolute(!) path to your local private ssh key
SSH_KEY_PASSWORD - your ssh key password (if there's none - leave empty)
{
"repositories": {
"test": "git@github.com:SergeyDarn/test-module-js.git",
"storefront-query-builder": "https://github.com/DivanteLtd/storefront-query-builder.git",
"scrape-search-ai": "https://github.com/SergeyDarn/scrape-search-ai#dev",
"magnific-popup": "git@github.com:SergeyDarn/Magnific-Popup.git#1.8.0",
"Course_Bash": "git@github.com:SergeyDarn/Course_Bash-Programming.git#3a7a19020151b45a29896c9142723efe5b11a061"
}
}- Repository
test-module-jswith the nametest. Normal ssh link - Repository
storefront-query-builder. Normal https link - Repository
scrape-search-ai. Https link with the branchdev - Repository
Magnific-Popupwith the namemagnific-popup. Ssh link with the tag1.8.0(the app uses\d(\..*)+regex for determining that it's a tag). - Repository
Course_Bash-Programmingwith the nameCourse_Bash. Ssh link with a specific commit hash
# Help. List all available commands
./repos-manager -h
# Run the app
./repos-manager
# Run the app without cloning repositories in parallel. Much slower, but better log readability.
./repos-manager --parallel-cloning=false
# Forcibly delete the whole directory with your git repositories before running the app.
./repos-manager --safe=false
# See the list of git repositories that have unsaved local changes. No repositories are cloned when using this flag
./repos-manager --status
# Perform git pull for all repositories
./repos-manager --pullThis app can also be installed as a go module in your go program. It wasn't planned at first, but I decided to implement it for my Configs Manager app. It's not pretty and for sure doesn't follow the best practices for creating go modules (because I don't know them), but it works.



