Skip to content

Instantly share code, notes, and snippets.

View yusent's full-sized avatar
🏡
Working from home

Yusent Chig yusent

🏡
Working from home
View GitHub Profile
@yusent
yusent / custom_keys_git_ssh
Created April 26, 2023 02:42 — forked from vhermecz/custom_keys_git_ssh
Allow configuring multiple ssh deploy keys with git
#!/bin/bash
# Script to use custom ssh keys for various git repositories
# Run without arguments to get usage info.
#
# How it works:
# When used with SSH, git sends the path to the repository in the SSH command.
# @see: https://github.com/git/git/blob/e870325/connect.c#L1268
# We extract this info and search for a key with the name.
# Based on the source, this seems to be used format since v2.0 at least.
# @see: https://github.com/git/git/commit/a2036d7