Clone a GitHub repository into your workspace with one command!
Clone a GitHub repository into your workspace with one command!
GH_CLONE_WORKSPACE_DIR=~/develop/workspace
GH_CLONE_DEFAULT_GITHUB_USER=sei40kr
# equivalent to `git clone https://github.com/sei40kr/dotfiles ~/develop/workspace/sei40kr/dotfiles`
gh-clone dotfiles
zinit ice trigger-load'!gh-clone'
zinit light sei40kr/zsh-gh-clone
zplug sei40kr/zsh-gh-clone
Variable | Default Value | Description |
---|---|---|
GH_CLONE_WORKSPACE_DIR |
'' |
Workspace directory where you clone repositories |
GH_CLONE_DEFAULT_GITHUB_USER |
"$(git config github.user)" |
Default GitHub user. If username omitted, this will be used instead. |
Configure your .gitconfig
like shown below:
[url "git@github.com:sei40kr"]
insteadOf "https://github.com/sei40kr"
Configure your .gitconfig
like shown below:
[url "git@github-private:sei40kr"]
insteadOf "https://github.com/sei40kr"
[url "git@github.com:sei40kr-work"]
insteadOf "https://github.com/sei40kr-work"
Then specify a key to use in your .ssh/config
too:
Host github-private
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_private
You also need to make sure the permission for .ssh/config
set properly:
chmod 600 ~/.ssh/config