Giterate is a wrapper that will help you to easily deal with multiple git repositories from multiple sources.
With Giterate, you can:
- recursively clone repositories accross gitlab groups / bitbucket projects according to JSON or YAML configuration file
- execute almost all git commands on all (or filtered subset of) repositories
- execute custom git commands
- Download the latest release binary corresponding to your system
- For Linux: put the binary somewhere on your path (example: /usr/bin)
- For Windows: put the binary somewhere on your computer (example: C:/giterate) and update the path variable
By default, giterate will use config.json or config.yaml file (in this order) in ~/.giterate folder Each git provider will have the same available parameters:
- BaseURL: Base URL of the git provider
- Name: Name of the git provider (easier to filter with --provider base URL or name)
- API: Type of api (can be gitlab, bitbucketv1, bitbucketv2 or github)
- ApiURI: URI of the api
- ApiToken: API token (required with ssh authentication)
- CloneType: Type of authentication (can be ssh or http)
- Username: username for authentication
- Password: password for authentication
- SSHPrivateKeyPath: absolute path to private key (required with ssh authentication)
- Destination: default destination directory
- CloneOptions: global clone options array
- Key: Name of the clone option
- Value: Value of the clone option
- Entities: List of repositories and groups to clone
- Type: Type of entity, can be repository or group
- Path: path to the entity (e.g. group, project, etc)
- Name: name to the entity (e.g. name of the group, name of the repository)
- Destination: destination absolute path. If not given, will take the default destination + path of entity
- Recurse: in case of group, will clone recursively
- CloneOptions: clone options array
- Key: Name of the clone option
- Value: Value of the clone option
You can find an example of configuration file on this repository
-
clone: clone repositories according to configuration file
- if the repository already exists or is already clone, it will not be updated
- parameters:
- --force: will clean all an recreate from conf
- -r, --repository URL or path: target one or multiple repositories (chain multiple times)
- -p, --provider base URL or name: target one or multiple providers (chain multiple times)
-
pull: pull repositories on current branches according to configuration file
- parameters
- -r, --repository URL or path: target one or multiple repositories (chain multiple times)
- -p, --provider base URL or name: target one or multiple providers (chain multiple times)
- parameters
-
fetch: fetch repositories on current branches according to configuration file
- parameters
- -r, --repository URL or path: target one or multiple repositories (chain multiple times)
- -p, --provider base URL or name: target one or multiple providers (chain multiple times)
- parameters
-
status: check status of each git repositories according to configuration file
- parameters
- -f, --full: show status of all repositories, even if there's no uncommited changes
- -r, --repository URL or path: target one or multiple repositories (chain multiple times)
- -p, --provider base URL or name: target one or multiple providers (chain multiple times)
- parameters
-
checkout: checkout the configured/default branch on all repositories
- parameters
- --force: reset uncommited changes
- -r, --repository URL or path: target one or multiple repositories (chain multiple times)
- -p, --provider base URL or name: target one or multiple providers (chain multiple times)
- parameters
-
commit: check changes and ask for commit message in case of changes
- if you don't provide any message, it will go to the next one without commiting
- parameters
- -g, --global: define a single message for all commits (you'll have to answer "yes" instead of providing a message)
- -r, --repository URL or path: target one or multiple repositories (chain multiple times)
- -p, --provider base URL or name: target one or multiple providers (chain multiple times)
-
push: push commited changes
- if you don't provide any message, it will go to the next one without commiting
- parameters
- --force: push without asking
- -r, --repository URL or path: target one or multiple repositories (chain multiple times)
- -p, --provider base URL or name: target one or multiple providers (chain multiple times)
-
providers: list configured providers
-
repositories: list configured repositories
- parameters
- -p, --provider base URL or name: target one or multiple providers (chain multiple times)
- parameters
-
exec: execute a custom git command
- parameters
- -c, --command 'command' : command to be executed
- -r, --repository URL or path: target one or multiple repositories (chain multiple times)
- -p, --provider base URL or name: target one or multiple providers (chain multiple times)
- parameters
- --config-file: set json/yaml configuration file path
- --log-level: set log level (info, warn, error, debug). default: info
- Gitlab (https://www.github.com/xanzy/go-gitlab)
- Bitbucket V1 (https://www.github.com/gfleury/go-bitbucket-v1)
- Bitbucket V2 (https://www.github.com/ktrysmt/go-bitbucket)
- Github (https://www.github.com/google/go-github/github)
Basic clone command
giterate clone
Use alternative config file
giterate clone --config-file ~/giterate-config.json
Pull from a specific provider name from the configuration file
giterate pull --provider gitlab-mycompany
Get the status of a specific provider URL from the configuration file
giterate status --provider https://gitlab.mycompany.com
Repository: https://gitlab.mycompany.com (/home/usr/giterate/mycompany)
Branch: master
Changes:
MM crypted.auto.tfvars
M directory/file.json
M directory2/other_file.php
Repository: https://gitlab.mycompany.com (/home/usr/giterate/mycompany)
Branch: develop
Changes:
M file.txt
MM other_file.json
Commit
giterate commit
Repository: ssh://git@gitlab.*****.com:7999/path/repo.git (/home/usr/giterate/gitlab/repo)
Branch: production
Changes:
M full/path/to/file.pp
Enter commit message (let empty to ignore): update puppet configuration for repo
Repository: https://git.****.com/path/other_repo.git (/home/usr/giterate/gitlab/other_repo)
Branch: master
Changes:
M full/path/to/file.json
Enter commit message (let empty to ignore): update json configuration for other_repo
Execute a custom command on a subset of repositories
giterate exec -c 'reset --hard' -r /home/usr/giterate/bitbucketv1/repo1 -r /home/usr/giterate/bitbucketv1/repo2
- implement tests
- implement parameters