Skip to content

Instantly share code, notes, and snippets.

@carlosezam
Last active August 30, 2025 14:29
Show Gist options
  • Select an option

  • Save carlosezam/b5689ed0007885ade19938957a0a6b50 to your computer and use it in GitHub Desktop.

Select an option

Save carlosezam/b5689ed0007885ade19938957a0a6b50 to your computer and use it in GitHub Desktop.
SSH

Generate SSH key

Generate a new SSH key

ssh-keygen -t ed25519 -C "your_email@example.com"

if the system doesn't support Ed25519

ssh-keygen -t rsa -b 4096 -C "your_email@youremail.com"

Copy to clipboar

pbcopy < ~/.ssh/id_rsa.pub

or in windows

type ~/.ssh/id_rsa.pub | clip

Configure multiple keys

Configure ~/.ssh/config

Host github.com
	HostName github.com
	User git
	IdentityFile ~/.ssh/github_id_rsa

Host ssh.dev.azure.com
	HostName ssh.dev.azure.com
	User git
	IdentityFile ~/.ssh/azure_id_rsa	

Test

ssh -T git@github.com

ssh -T git@ssh.dev.azure.com

Miscellaneous

Config host project

git remote set-url origin git@<host-in-ssh-config>:<username>/<repo>

Initial config

git config --global user.name "name"
git config --global email "you@email.com"

Basic aliases

git config --global alias.co checkout
git config --global alais.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.h "log --oneline --graph"
git config --global alias.ha "log --oneline --graph --all"

git config --global alias.update '!f() { git fetch origin "$1:$1"; }; f'

Basic config

git config --global push.autoSetupRemote true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment