{"id":15502805,"url":"https://github.com/j-siu/mygit","last_synced_at":"2026-04-10T17:05:57.427Z","repository":{"id":132734739,"uuid":"282794669","full_name":"J-Siu/mygit","owner":"J-Siu","description":"Bash git automation script support group action.","archived":false,"fork":false,"pushed_at":"2022-05-25T07:52:41.000Z","size":73,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-19T17:28:54.034Z","etag":null,"topics":["git","golang"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/J-Siu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-27T04:34:59.000Z","updated_at":"2022-05-01T00:30:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"d864599c-b356-4033-826d-a1ab9e3d1fef","html_url":"https://github.com/J-Siu/mygit","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J-Siu%2Fmygit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J-Siu%2Fmygit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J-Siu%2Fmygit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J-Siu%2Fmygit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/J-Siu","download_url":"https://codeload.github.com/J-Siu/mygit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246077435,"owners_count":20719989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","golang"],"created_at":"2024-10-02T09:11:10.765Z","updated_at":"2025-12-30T23:20:08.786Z","avatar_url":"https://github.com/J-Siu.png","language":"Shell","funding_links":["https://www.paypal.com/donate/?business=HZF49NM9D35SJ\u0026no_recurring=0\u0026currency_code=CAD"],"categories":[],"sub_categories":[],"readme":"## MyGit [![Paypal donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/donate/?business=HZF49NM9D35SJ\u0026no_recurring=0\u0026currency_code=CAD)\n\n\u003e Deprecated: This project is now migrated to [go-mygit/v2](https://github.com/J-Siu/go-mygit).\n\nBash script doing git actions with group support.\n\n### Table Of Content\n\u003c!-- TOC --\u003e\n\n- [MyGit ](#mygit-)\n  - [Who \\\u0026 Why](#who--why)\n  - [Features](#features)\n  - [Limitation](#limitation)\n  - [Usage](#usage)\n    - [Configuration File](#configuration-file)\n    - [Testing](#testing)\n    - [Debug](#debug)\n    - [Info](#info)\n      - [remote](#remote)\n      - [group](#group)\n    - [Selector](#selector)\n      - [-g/--group](#-g--group)\n      - [-r/--remote](#-r--remote)\n    - [Git Base Commands](#git-base-commands)\n      - [init](#init)\n      - [push](#push)\n        - [--master](#--master)\n        - [--all](#--all)\n      - [fetch](#fetch)\n    - [API Repo Commands](#api-repo-commands)\n      - [Remote Information](#remote-information)\n      - [Visibility Flags](#visibility-flags)\n      - [new](#new)\n      - [vis/visibility](#visvisibility)\n      - [del/delete](#deldelete)\n        - [Github](#github)\n      - [desc/description](#descdescription)\n      - [topic/topics](#topictopics)\n      - [ls/list](#lslist)\n    - [API Workflow Commands](#api-workflow-commands)\n      - [List Workflow](#list-workflow)\n      - [Dispatch](#dispatch)\n  - [New Repository Workflow](#new-repository-workflow)\n  - [Repository](#repository)\n  - [Contributors](#contributors)\n  - [Change Log](#change-log)\n  - [License](#license)\n\n\u003c!-- /TOC --\u003e\n\u003c!--more--\u003e\n\n\u003e [go-mygit](https://github.com/J-Siu/go-mygit) replaced this project.\n\n### Who \u0026 Why\n\n- Creating repositories for same set of remote servers repeatedly\n- Setting up repositories on multiple machines repeatedly\n- Working with repositories that push to same set of git servers\n\n### Features\n\n- Info\n  - [x] debug\n  - [x] remote\n  - [x] group\n- Selector\n  - [x] -g/--group\n  - [x] -r/--remote\n- Git Base Commands\n  - [x] fetch\n  - [x] init\n  - [x] push\n    - [x] --master\n    - [x] --all\n- API Base Commands\n  - [x] repo/repository\n    - [x] --pri/--private\n    - [x] --pub/--public\n    - [x] del/delete\n    - [x] ls/list\n      - [x] --archive\n    - [x] new\n    - [x] vis/visibility\n    - [x] desc/description\n    - [x] topic/topics\n  - [x] disp/dispatch\n    - [x] list\n    - [x] dispatch\n\n### Limitation\n\n- Strict option/argument order\n- Minimum command line error detection\n- Current supported git servers\n  - gitea\n  - github\n  - gogs\n- API commands must be executed at root of repository\n\n### Usage\n\n```sh\nmygit version 0.2.3\nLicense : MIT License Copyright (c) 2020 John Siu\nSupport : https://github.com/J-Siu/mygit/issues\nDebug   : export _DEBUG=true\nUsage   :\nmygit remote                                                       # Show remotes in config\nmygit group                                                        # Show groups in config\nmygit [-g \u003cgroup\u003e] [-r \u003cremote\u003e] fetch                             # Git fetch\nmygit [-g \u003cgroup\u003e] [-r \u003cremote\u003e] init [\u003crepository name\u003e]          # Git init\nmygit [-g \u003cgroup\u003e] [-r \u003cremote\u003e] push [--all|--master]             # Git push\nmygit [-g \u003cgroup\u003e] [-r \u003cremote\u003e] repo                              # API get remote repository information\nmygit [-g \u003cgroup\u003e] [-r \u003cremote\u003e] repo del                          # API delete remote repository\nmygit [-g \u003cgroup\u003e] [-r \u003cremote\u003e] repo desc \"\u003cdescription\u003e\"         # API change remote repository description\nmygit [-g \u003cgroup\u003e] [-r \u003cremote\u003e] repo ls [--archive]               # API list all remote repository\nmygit [-g \u003cgroup\u003e] [-r \u003cremote\u003e] repo new [--pri|--pub]            # API create remote repository\nmygit [-g \u003cgroup\u003e] [-r \u003cremote\u003e] repo topic \"\u003ctopics...\u003e\"          # API change remote repository topic\nmygit [-g \u003cgroup\u003e] [-r \u003cremote\u003e] repo vis/visibility [--pri|--pub] # API change remote repository visibility\n-- GitHub only --\nmygit [-g \u003cgroup\u003e] [-r \u003cremote\u003e] wf|workflow                       # API workflow list\nmygit [-g \u003cgroup\u003e] [-r \u003cremote\u003e] wf|workflow disp|dispatch \u003cevent\u003e # API workflow dispatch\n```\n\n#### Configuration File\n\nFollowing configuration will be used in all examples:\n\n```sh\n# This should be put in ~/.mygit.conf\n\n# \u003cremote name\u003e\n\n# MY_GIT[\u003cremote name\u003e.del]=\"\"\t# API token with delete scope. Mainly for Github.\n# MY_GIT[\u003cremote name\u003e.grp]=\"\"\t# Group name of remote.\n# MY_GIT[\u003cremote name\u003e.ssh]=\"\"\t# SSH hostname / SSH config host.\n# MY_GIT[\u003cremote name\u003e.tok]=\"\"\t# API token.\n# MY_GIT[\u003cremote name\u003e.uri]=\"\"\t# API URI.\n# MY_GIT[\u003cremote name\u003e.usr]=\"\"\t# API username.\n# MY_GIT[\u003cremote name\u003e.ven]=\"\"\t# Vendor: github|gites|gogs\n# MY_GIT[\u003cremote name\u003e.pri]=\"\"\t# Private visibility: true|false. Default to true if not set.\n\nMY_GIT[gh.del]=\"1234567890abcdef1234567890abcdef12345678\"\nMY_GIT[gh.grp]=\"external\"\nMY_GIT[gh.ssh]=\"git@github.com\"\nMY_GIT[gh.tok]=\"234567890abcdef1234567890abcdef123456789\"\nMY_GIT[gh.uri]=\"https://api.github.com\"\nMY_GIT[gh.usr]=\"username1\"\nMY_GIT[gh.ven]=\"github\"\nMY_GIT[gh.pri]=\"false\"\n\nMY_GIT[server2.grp]=\"internal\"\nMY_GIT[server2.ssh]=\"git@server2\"\nMY_GIT[server2.tok]=\"34567890abcdef1234567890abcdef1234567890\"\nMY_GIT[server2.uri]=\"https://server2/api/v1\"\nMY_GIT[server2.usr]=\"username2\"\nMY_GIT[server2.ven]=\"gitea\"\n\nMY_GIT[server3.grp]=\"internal\"\nMY_GIT[server3.ssh]=\"git@server3\"\nMY_GIT[server3.tok]=\"4567890abcdef1234567890abcdef1234567890a\"\nMY_GIT[server3.uri]=\"https://server3/api/v1\"\nMY_GIT[server3.usr]=\"username3\"\nMY_GIT[server3.ven]=\"gitea\"\n```\n\n#### Testing\n\n```sh\ngit clone https://github.com/J-Siu/mygit.git\ncd mygit\ncp mygit.conf ~/.mygit.conf\n```\n\nExample below can be tested inside `mygit` dir.\n\n#### Debug\n\nUse following to enable debug output:\n\n```sh\nexport _DEBUG=1\n```\n\n#### Info\n\nThe `remote` and `group` command provide a quick way to see what is configured.\n\n##### remote\n\nTo show all `remotes` configured:\n\n```sh\nmygit remote\n```\n\nOutput:\n\n```sh\ngh (external)\nserver3 (internal)\nserver2 (internal)\n```\n\n##### group\n\nTo show all `groups` configured:\n\n```sh\nmygit group\n```\n\nOutput:\n\n```sh\nexternal internal\n```\n\n#### Selector\n\n`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.\n\n`-g/--group` and `-r/--remote` must be placed right after `mygit` and before any command.\n\n##### -g/--group\n\n```sh\nmygit -g external \u003ccommand\u003e\nmygit -g external -g internal \u003ccommand\u003e\n```\n\n##### -r/--remote\n\n```sh\nmygit -r gh \u003ccommand\u003e\nmygit -r gh -r server3 \u003ccommand\u003e\n```\n\n`-g/--group` and `-r/--remote` can be used at the same time.\n\n```sh\nmygit -g external -r server2 \u003ccommand\u003e\n```\n\n#### Git Base Commands\n\n`init`, `fetch`, `push` are git base commands.\n\n##### init\n\n`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.\n\n`mygit init` by default use current directory name as repository name. Repository name can be specified in the format `mygit init \u003crepository\u003e`. File `.mygit` containing the repository name will be created, which is used by API based commands.\n\nBefore `mygit init`:\n\n```sh\n$ git remote -v\norigin  https://github.com/J-Siu/mygit.git (fetch)\norigin  https://github.com/J-Siu/mygit.git (push)\n```\n\n`mygit init` without selector:\n\n```sh\n$ mygit init\nReinitialized existing Git repository in /tmp/mygit/.git/\n\n$ git remote -v\ngh      git@github.com:/username1/mygit.git (fetch)\ngh      git@github.com:/username1/mygit.git (push)\nserver2 git@server2:/username2/mygit.git (fetch)\nserver2 git@server2:/username2/mygit.git (push)\nserver3 git@server3:/username3/mygit.git (fetch)\nserver3 git@server3:/username3/mygit.git (push)\n```\n\n`mygit init` with group internal:\n\n```sh\n$ mygit --group internal init\nReinitialized existing Git repository in /tmp/mygit/.git/\n\n$ git remote -v\nserver2 git@server2:/username2/mygit.git (fetch)\nserver2 git@server2:/username2/mygit.git (push)\nserver3 git@server3:/username3/mygit.git (fetch)\nserver3 git@server3:/username3/mygit.git (push)\n```\n\n`mygit init` with repository name:\n\n```sh\n$ mygit init mygit2\nReinitialized existing Git repository in /tmp/mygit/.git/\n\n$ git remote -v\ngh      git@github.com:/username1/mygit2.git (fetch)\ngh      git@github.com:/username1/mygit2.git (push)\nserver2 git@server2:/username2/mygit2.git (fetch)\nserver2 git@server2:/username2/mygit2.git (push)\nserver3 git@server3:/username3/mygit2.git (fetch)\nserver3 git@server3:/username3/mygit2.git (push)\n```\n\n##### push\n\n`mygit push` will do `git push` and `git push --tag` base on `-g`/`-r` selector. If no group nor remote are specified, all configured remotes will be pushed in sequence.\n\n```sh\nmygit push\n```\n\n```sh\nmygit -r gh push\n```\n\n`mygit push` support options `--master` and `--all`\n\n###### --master\n\nIf `--master` is used, `mygit push` will push to upstream(`-u`) master branch.\n\n```sh\nmygit push --master\n```\n\n###### --all\n\nIf `--all` is used, `mygit push` will push all branches(`--all`).\n\n```sh\nmygit -r gh push --all\n```\n\n##### fetch\n\n`fetch` will do `git fetch` base on `-g`/`-r` selector. If no group nor remote are specified, all configured remotes will be fetched in sequence.\n\n```sh\nmygit fetch\n```\n\n```sh\nmygit -r gh fetch\n```\n\n#### API Repo Commands\n\n`mygit repo \u003ccommand\u003e` are API base command. With exception of `mygit repo ls/list`, all API commands must be ran at root of repository.\n\n##### Remote Information\n\n`mygit repo` without specifying additional command will retrieve repository information from remote server.\n\n##### Visibility Flags\n\n`--pri`, `--private`, `--pub`, `--public` are options for `repo new` and `repo vis` below.\n\n##### new\n\n`mygit repo new` will create repository on remote server.\n\nBy default repository will be created with private visibility. This can be override with `MY_GIT[\u003cremote name\u003e.pri]=\"false\"` in configuration file `~/.mygit.conf` on a per remote basis. Or override with `--pri/--pub` in command line.\n\n```sh\nmygit repo new\n```\n\n```sh\nmygit repo new --pub\n```\n\n```sh\nmygit -g internal repo new\n```\n\n##### vis/visibility\n\n`mygit repo vis` will get visibility status from remote.\n\n```sh\nmygit repo vis\nmygit -g external repo visibility\n```\n\nUse `--pri/--pub` to change visibility settings on remote server.\n\n```sh\nmygit repo vis --pub\nmygit -g external repo vis --pri\n```\n\n##### del/delete\n\n\u003e THERE IS NO CONFIRMATION FOR DELETION.\n\n`mygit repo del` will delete repository from remote.\n\n```sh\nmygit repo del\nmygit -g external repo delete\n```\n\n###### Github\n\nGithub token need `delete_repo` scope to delete repository through API. Either use a token with that scope in `MY_GIT[\u003cremote name\u003e.tok]` or a separate token and put it in `MY_GIT[\u003cremote name\u003e.del]`.\n\n##### desc/description\n\n`mygit repo desc` will get description of remote repository.\n\n```sh\nmygit repo desc\nmygit -g external repo desc\n```\n\n`mygit repo desc \"\u003cdescription\u003e\"` can update description of remote repository. Description needs to be in double quote.\n\n```sh\nmygit repo desc \"\u003cdescription\u003e\"\nmygit -g external repo desc \"\u003cdescription\u003e\"\n```\n\n##### topic/topics\n\n`mygit repo topic` will get topics of remote repository.\n\n```sh\nmygit repo topic\nmygit -g external repo topic\n```\n\n`mygit repo topic \"topics ...\"` can update topics of remote repository. Multiple topics needs to be in double quote.\n\n```sh\nmygit repo topic \"topic1 topic2 topic3\"\nmygit -g external repo topic \"topic1 topic2 topic3\"\n```\n\n##### ls/list\n\n`mygit repo ls` will list up to 100 repositories on remote server. This command does not depend on repository.\n\nBy default archived repositories are filtered out. Use `--archive` to show them also.\n\n```sh\nmygit repo ls\nmygit repo ls --archive\nmygit -g internal repo ls\nmygit -r gh repo ls\n```\n\n#### API Workflow Commands\n\n`mygit wf|workflow \u003ccommand\u003e` are API base workflow commands.\n\nAll workflow commands must be ran at root of repository.\n\n\u003e Workflow commands only work on GitHub repositories.\n\n##### List Workflow\n\n`mygit wf` will get all workflow information of a repository\n\n```sh\nmygit wf\nmygit workflow\n```\n\n##### Dispatch\n\n`mygit wf disp|dispatch \u003cevent\u003e` will trigger a `repository_dispatch` event. Workflows file must configure accordingly.\n\nWorkflow file:\n\n```yml\nname: Release\non:\n  push:\n    tags:\n      - \"*\"\n  repository_dispatch:\n    types: \u003cevent\u003e\n...\n```\n\n```sh\nmygit workflow \u003cevent\u003e\n```\n\n### New Repository Workflow\n\nAssuming `~/.mygit.conf` is setup.\n\n```sh\nmygit init\nmygit repo new\nmygit push --master\n```\n\n### Repository\n\n- [mygit](https://github.com/J-Siu/mygit)\n\n### Contributors\n\n- [John Sing Dao Siu](https://github.com/J-Siu)\n\n### Change Log\n\n- 0.1.0\n  - Feature complete\n- 0.2.0\n  - README.md completed\n  - add -g/-r checking\n  - add init repository name support\n  - add repo get info\n  - add repo ls --archive flag\n  - add usage\n  - change push master/all to flag(--)\n  - fix comment typo\n  - fix repo del github del token logic\n  - fix repo ls gogs/gitea support\n  - fix repo new visibility logic\n  - move desc, topic into repo\n- 0.2.1\n  - Improve debug log\n  - change _mygit_group write to MY_GIT_GROUP directly\n  - change _mygit_remote write to MY_GIT_REMOTE directly\n  - change repo del allow independent of local remote\n  - change shebang to #!/usr/bin/env bash\n  - fix ARGP leak for push\n  - fix _in_group call missing \"\" for group\n  - fix _in_group call wrapped with $() incorrectly\n  - fix _in_group var conflict, change _g -\u003e _x\n- 0.2.2\n  - fix repo new visibility\n- 0.2.3\n  - add workflow list and event dispatch for GitHub\n\n### License\n\nThe MIT License (MIT)\n\nCopyright (c) 2020 John Siu\n\nPermission 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:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-siu%2Fmygit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj-siu%2Fmygit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-siu%2Fmygit/lists"}