https://github.com/jnbdz/gitmultihost
A tool to help quickly select an SSH host for git clone and git remote. 🐙
https://github.com/jnbdz/gitmultihost
bash git git-multi-profile shell ssh-hosts utility
Last synced: about 2 months ago
JSON representation
A tool to help quickly select an SSH host for git clone and git remote. 🐙
- Host: GitHub
- URL: https://github.com/jnbdz/gitmultihost
- Owner: jnbdz
- License: mit
- Created: 2024-03-04T17:36:06.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-22T23:10:21.000Z (about 2 years ago)
- Last Synced: 2025-02-28T08:14:00.984Z (over 1 year ago)
- Topics: bash, git, git-multi-profile, shell, ssh-hosts, utility
- Language: Shell
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gitmultihost
Shell tool to facilitate the usage of `git` in a context where you have multiple hosts in your `~/.ssh/config`.
This script automatically catches the HTTPS or the SSH url and then using [`fzf`](https://github.com/junegunn/fzf) (general-purpose command-line fuzzy finder) to give you a quick way to select a host that is in `~/.ssh/config`.
## Install
```bash
sudo make install
```
## How-to
### Cloning a repo
```bash
gitmultihost clone git@github.com:user/repo.git
```
What follows is [`fzf`](https://github.com/junegunn/fzf) listing the hosts. After selecting a host it will change the `github.com` (or any other domain name) with the host selected.
### Changing the remote origin
This is useful if there are already repositories that have not been configured to used one of the hosts.
```bash
gitmultihost remote set-url origin git@github.com:user/repo.git
```
It will do the same as cloning and will ask you with [`fzf`](https://github.com/junegunn/fzf) what host you want to use.
### Any Other Command
Those were just examples of what can be done with the tool. Any other `git` command can be used and every time there is a HTTPS or a SSH url it will give the option to select a different host based on what is in `~/.ssh/config`.