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 testrepo

Installation

Pick your package manager:

mise

mise use github:github.com/pratyay360/forgit@latest

Homebrew

brew trust --cask pratyay360/tap/forgit
brew install pratyay360/tap/forgit

Scoop (Windows)

scoop bucket add pratyay360 https://github.com/Pratyay360/scoop-bucket
scoop install pratyay360/forgit

WinGet (Windows)

winget install pratyay360.forgit

Stew

stew install pratyay360/forgit

Direct download

Latest release on github

asciicast

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

Taskghglabfjforgit
List reposgh repo listglab repo listfj repo list --hostname codeberg.orgforgit repos
Auth per forgegh auth loginglab auth loginfj auth loginone config file
create repogh repo create test --publicglab repo create demo --publicfj repo create test --publicforgit repo create --instance bitbucket --owner pratyaymustafi testrepo
delete repogh repo delete Pratyay360/testglab repo delete Pratyay360/demofj 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 test

Please feel free to suggest any changes you feel important Any kind of contribution is heavily admired.

Comments