Skip to content

This is a very very simple script that helps me to switch for a differents profiles on my Mac.OS Feel free to copy and use FULL FREE =)

Notifications You must be signed in to change notification settings

devMoisa/tool.gitHubSwitcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 

Repository files navigation

ghset - SSH Profile Switcher for GitHub and Bitbucket

This script allows you to quickly switch between different SSH profiles for GitHub and Bitbucket, making it easy to manage multiple accounts (personal, work, etc.) on the same machine.


πŸ“¦ Available Profiles

  • belmo β†’ Example profile (requires your SSH key path)
  • oppy β†’ Example profile (requires your SSH key path)
  • personal β†’ Example profile (requires your SSH key path)

You can rename or edit these profiles inside the script to match your own setup.


πŸš€ Installation

  1. Clone the repository or download the script:
git clone https://github.com/yourusername/ghset.git
cd ghset
  1. Make the script executable:
chmod +x ghset.sh
  1. (Optional) Move it to a directory in your PATH to run it from anywhere:
sudo mv ghset.sh /usr/local/bin/ghset

πŸ›  Usage

Show current profile and help

ghset

Switch to a specific profile

ghset belmo
ghset oppy
ghset personal

πŸ”‘ SSH Keys Setup

Before using the script, you must create your own SSH keys and add their paths in the script for each profile.

Example for creating a new SSH key:

ssh-keygen -t ed25519 -C "[email protected]"

Then update the script with the correct paths to your private keys, for example:

~/.ssh/id_belmo
~/.ssh/id_oppy
~/.ssh/id_personal

Make sure the corresponding public keys (.pub files) are also present.


πŸ” What the script does

  1. Validates that the SSH keys exist for the selected profile.
  2. Backs up your current ~/.ssh/config to ~/.ssh/config.backup.
  3. Replaces the SSH config with the selected profile's settings.
  4. Clears old keys from the ssh-agent.
  5. Adds the selected profile's SSH key to the agent.
  6. Tests the connection to GitHub.

πŸ“Œ Example Output

$ ghset oppy
Backup created: /Users/youruser/.ssh/config.backup
Profile switched to: oppy
SSH Key: ~/.ssh/id_oppy

Testing connection...
Hi youruser! You've successfully authenticated, but GitHub does not provide shell access.

πŸ“œ License

MIT

About

This is a very very simple script that helps me to switch for a differents profiles on my Mac.OS Feel free to copy and use FULL FREE =)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages