Forgit, one cli for all the git forges
One CLI supports GitHub, GitLab, Gitea, Forgejo, Bitbucket, and SourceHut.
Managing code across multiple Git forges can be done with a single CLI, Git, why not use one tool to interact with all Git forges from a single place? Why have 10 different tools for the interaction part? like gh, glab, fj, hut
forgit tries to solve this: one CLI, one command set for all the forges.
forgit repos
forgit issue list
forgit prs
forgit repo create testrepo --instance github --public
forgit repo delete --instance gitlab --owner pratyay360 testrepoInstallation
Pick your package manager:
mise
mise use github:github.com/pratyay360/forgit@latestHomebrew
brew trust --cask pratyay360/tap/forgit
brew install pratyay360/tap/forgitScoop (Windows)
scoop bucket add pratyay360 https://github.com/Pratyay360/scoop-bucket
scoop install pratyay360/forgitWinGet (Windows)
winget install pratyay360.forgitStew
stew install pratyay360/forgitDirect download
Configuration
One $HOME/.config/forgit/config.toml defines all your forges:
## $HOME/.config/forgit/config.toml
[github]
token = "echo $GITHUB_PAT"
[gitlab]
url = "https://gitlab.com"
token = "echo $GITLAB_PAT"
[forgejo]
url = "https://codeberg.org"
token = "echo $CODEBERG_PAT"
[bitbucket]
token = "echo $BITBUCKET_PAT"
username = "pratyaymustafi@outlook.com" # bitbucket registered email
[sourcehut]
token = "echo $SOURCE_HUT_PAT"
[[instance]]
name = "gitgud"
type = "gitlab"
url = "https://gitgud.io"
token = "echo $GITGUD_PAT"Comparison: forgit vs. forge specific CLIs
| Task | gh | glab | fj | forgit |
|---|---|---|---|---|
| List repos | gh repo list | glab repo list | fj repo list --hostname codeberg.org | forgit repos |
| Auth per forge | gh auth login | glab auth login | fj auth login | one config file |
| create repo | gh repo create test --public | glab repo create demo --public | fj repo create test --public | forgit repo create --instance bitbucket --owner pratyaymustafi testrepo |
| delete repo | gh repo delete Pratyay360/test | glab repo delete Pratyay360/demo | fj repo delete <owner>/<repo> | forgit repo delete --instance sourcehut pratyaymustafi/testrepo |
Contributing
I am using mise in the process of development to make development environment as identical as possible
git clone https://github.com/Pratyay360/forgit
cd forgit
mise deps
mise run testPlease feel free to suggest any changes you feel important Any kind of contribution is heavily admired.
Comments