Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xn-sakina/tanyao
Git repo clone and multi-account manager
https://github.com/xn-sakina/tanyao
git git-repo-manager
Last synced: about 1 month ago
JSON representation
Git repo clone and multi-account manager
- Host: GitHub
- URL: https://github.com/xn-sakina/tanyao
- Owner: xn-sakina
- License: mit
- Created: 2023-02-11T21:33:46.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-29T22:47:44.000Z (10 months ago)
- Last Synced: 2024-11-15T02:09:20.872Z (about 2 months ago)
- Topics: git, git-repo-manager
- Language: TypeScript
- Homepage:
- Size: 70.3 KB
- Stars: 45
- Watchers: 0
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tanyao
Git repo clone and multi-account manager
## Install
```bash
pnpm i -g tanyao
```## Usage
1. Init config on first use :
```bash
tanyao init
```2. [Config](#config) your `base` directory and git account info.
3. Clone repo from anywhere :
```bash
tanyao clone https://github.com/xn-sakina/tanyao.git
# or
tanyao clone [email protected]:xn-sakina/tanyao.git
# or ...
tanyao clone https://github.com/xn-sakina/tanyao.git ./tmp-path
```
directory structure :```ts
base
├── github.com
│ └── xn-sakina
│ └── tanyao
└── gitlab.com
└── owner
└── repo
```## Config
Open `~/.config/tanyao/config.json`, set up a code `base` and git account info :
```ts
// ~/.config/tanyao/config.json
{
"base": "/Users/username/Documents/Code",
"codebase": [
{
"url": "github.com",
"username": "github-username",
"email": "[email protected]"
},
{
"url": "gitlab.com",
"username": "gitlab-username",
"email": "[email protected]"
}
],
"alias": {
"github://": "https://github.com/"
}
}
```### Advanced config
#### Shell alias (Recommend)
```bash
# ~/.zshrcalias -s git="tanyao clone"
```This will make the :
```bash
$ https://github.com/xn-sakina/tanyao.git
# equal
$ tanyao clone https://github.com/xn-sakina/tanyao.git
```See [Suffix aliases (-s) in Zsh](https://www.stefanjudis.com/today-i-learned/suffix-aliases-in-zsh/) learn more.
#### Flexible `base`
```ts
// ~/.config/tanyao/config.json
{
"base": [
// use `process.env.CODE_BASE`
"{CODE_BASE}/dir",
// multiple `base`, select when clone
"Other/Codebase/Path"
]
}
```#### Multi GitHub accounts
example:
```ini
# .gitconfig[includeIf "gitdir:~/code_base_name/"]
path = ~/.gitconfig-code_base_name
``````ini
# ~/.gitconfig-code_base_name[user]
name = github_user_id
email = github_email
[core]
excludesfile = ~/.gitignore_global
sshCommand = ssh -i ~/.ssh/id_ed25519
[init]
defaultBranch = main
```See [How to Use Two GitHub Accounts on a Macbook the Right Way](https://fayazahmed.com/articles/how-to-use-two-github-accounts-on-a-macbook-the-right-way)
## Options
#### `--progress`
alias: `-p`
Show git clone progress.
#### `--depth`
alias: `-d`
Git clone depth.
## Thanks/Inspiration
- [projj](https://github.com/popomore/projj) : Manage repository easily.
## License
MIT