Command line tool for easy mass configuration of git remotes, and working with Github/Gites repositories API.
- Install
- Supported Platforms
- Highlight
- What It Does
- What It Does Not
- Features
- Usage
- Configuration
- Packages Used
- Repository
- Contributors
- License
This replaces the bash implementation mygit.
Go install
go install github.com/J-Siu/go-mygit/v2@latestDownload
- github
- gitea
- gogs(not tested)
Following are highlight of some go-mygit functions.
# Push to all remotes
go-mygit push
# Support path operation
go-mygit push docker_*# Set archived to true
go-mygit repo set archived true
# Set archived to false
go-mygit repo set archived false# Set current repository to private on server
go-mygit repo set private true
# Support path operation
go-mygit repo set private false docker_*# Update description on server of current repository/directory
go-mygit repo set description "This is a new description"# Update topics on server of current repository/directory
go-mygit repo set topic golang go projectThese are the reasons "mygit" got created.
- Parallel processing multiple repository, eg. pushing 10 repos at the same time
- Pushing same repo to multiple git servers which are not mirrored
- Set up same set of git remote repeatedly
- Update repository info on git server(api)
- Replace
gitcommand. (gitcommand is required for git function to work.) - Replace Github cli
gh(go-mygitonly cover limited number of api in comparison.)
- Configuration File
- remotes
- groups
- secrets
- Selector for git servers
- -g/--group
- -r/--remote
- Base(git) Commands
- clone
- init
- pull
- push
- remote
- add
- list
- remove
- Repository(api)
- list all repo on server
- create repo on server
- get / set
- actions (enable/disable)
- archived
- description
- discussions (enable/disable)
- private
- projects (enable/disable)
- public key (get only)
- secret
- topic
- visibility
- delete
- repository
- secret
Git and Repo automation made easy.
Usage:
go-mygit [command]
Available Commands:
clone Git clone
completion Generate the autocompletion script for the specified shell
config Print configurations
help Help about any command
init Git init and reset remotes
pull Git pull
push Git push
remote Git remote commands
repository Repository commands
Flags:
--config string config file (default is $HOME/.config/go-mygit.json)
-d, --debug Enable debug
-g, --group stringArray Specify group
-h, --help help for go-mygit
--no-parallel Don't process in parallel
--no-skip Don't skip empty output
--no-title Don't print title for most output
-r, --remote stringArray Specify remotes
Use "go-mygit [command] --help" for more information about a command.Use -d for debug output.
Example:
go-mygit -d repo des getgo-mygit allow command applied to groups or remotes through the use of -g/--group and -r/--remote. This applies to all commands except remote and group mentioned above.
-g/--group and -r/--remote must be placed right after mygit and before any command.
go-mygit -g external <command>
go-mygit -g external -g internal <command>go-mygit -r gh <command>
go-mygit -r gh -r server3 <command>-g/--group and -r/--remote can be used at the same time.
go-mygit -g external -r server2 <command>init, push are git base commands.
go-mygit init will clear all existing remote and add remote base on -g/-r selector. If no group nor remote are specified, all configured remotes will be added.
go-mygit init by default use current directory name as repository name. Repository name can be specified in the format go-mygit init <repository>. File .go-mygit.json containing the repository name will be created, which is used by API based commands.
Before go-mygit init:
$ git remote -v
origin https://github.com/J-Siu/mygit.git (fetch)
origin https://github.com/J-Siu/mygit.git (push)go-mygit init without selector:
$ go-mygit init
Reinitialized existing Git repository in /tmp/mygit/.git/
$ git remote -v
gh [email protected]:/username1/mygit.git (fetch)
gh [email protected]:/username1/mygit.git (push)
server2 git@server2:/username2/mygit.git (fetch)
server2 git@server2:/username2/mygit.git (push)
server3 git@server3:/username3/mygit.git (fetch)
server3 git@server3:/username3/mygit.git (push)go-mygit init with group internal:
$ go-mygit --group internal init
Reinitialized existing Git repository in /tmp/mygit/.git/
$ git remote -v
server2 git@server2:/username2/mygit.git (fetch)
server2 git@server2:/username2/mygit.git (push)
server3 git@server3:/username3/mygit.git (fetch)
server3 git@server3:/username3/mygit.git (push)go-mygit init with repository name:
$ go-mygit init mygit2
Reinitialized existing Git repository in /tmp/mygit/.git/
$ git remote -v
gh [email protected]:/username1/mygit2.git (fetch)
gh [email protected]:/username1/mygit2.git (push)
server2 git@server2:/username2/mygit2.git (fetch)
server2 git@server2:/username2/mygit2.git (push)
server3 git@server3:/username3/mygit2.git (fetch)
server3 git@server3:/username3/mygit2.git (push)go-mygit push base on -g/-r selector. If no group nor remote are specified, all configured remotes will be pushed in sequence.
go-mygit pushgo-mygit -r gh pushgo-mygit push support options --tags and --all
If --tags is used, go-mygit push will push all tags.
go-mygit push --tagsIf --all is used, mygit push will push all branches(--all).
go-mygit -r gh push --allSee go-mygit.json.md
The MIT License (MIT)
Copyright © 2025 John, Sing Dao, Siu [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
