Use Github/Gogs Api To Create Repo
☰ Table of Content
Gogs implemented Github api. The only different is the URL.
Token
No matter you are using Gogs or Github, you have to login your account and generate a token.
Gogs
Go into Settings -> Applications, then click Generate New Token.
Github
Go into Settings -> Developer settings -> Personal access tokens, then click Generate new token.
In both cases, copy&paste the token into a file right away. We will need it in our script/function below.
zsh function
| |
The only difference between gogs and github is the URL. Gogs need /api/v1 in its url, while github uses api sub-domain. Uncomment the one you want to use.
Add function in .zshrc and use as follow:
| |
Implementation
I have two fully functional implementations, please check them out:
| Language | Project |
|---|---|
| bash | mygit |
| golang | go-mygit |
John Siu
Update: 2022-05-25
See Also