Last active
June 1, 2017 14:44
-
-
Save rpetrich/cd6b99256766d80fc127c172d7579344 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$GIT_AUTHOR_EMAIL" ]; then | |
GIT_AUTHOR_EMAIL=`git config --get user.email` | |
fi | |
if [[ `uname` != Darwin ]]; then | |
IDENTITY=`readlink -f ~/.ssh/$GIT_AUTHOR_EMAIL` | |
elif which -s greadlink; then | |
IDENTITY=`greadlink -f ~/.ssh/$GIT_AUTHOR_EMAIL` | |
else | |
# No modern readlink with -f support, symlinks must be absolute paths :'( | |
IDENTITY=`readlink ~/.ssh/$GIT_AUTHOR_EMAIL` | |
fi | |
if [ -f "$IDENTITY" ]; then | |
exec ssh -o IdentitiesOnly=yes -i "$IDENTITY" $* | |
fi | |
echo "No symlink to a private key found for $GIT_AUTHOR_EMAIL at ~/.ssh/$GIT_AUTHOR_EMAIL, using default" >&2 | |
exec ssh $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew upgrade git && git --version | |
# Requires git 2.10 and later | |
git config --global core.sshCommand ~/bin/github-autodetect.sh | |
# Primary Identity | |
ln -s $USER/.ssh/id_rsa $USER/.ssh/[email protected] | |
git config --global user.email [email protected] | |
# Secondary Identity | |
ln -s $USER/.ssh/alterego_rsa $USER/.ssh/[email protected] | |
[email protected] git clone [email protected]:alter-ego/alter_project.git | |
cd alter_project | |
git config user.email [email protected] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment