git-profile

Branches

develop (2016-02-08 20:11:02 +0000)
master (2015-10-21 14:06:00 +0100)
test (2015-10-21 14:06:00 +0100)

Files

Name
.gitignore
LICENCE
README.md
setup-alias.sh
# Setting The SSH Key Git Uses

This script adds awareness to Git about which SSH key should be used when pushing to remotes over SSH.

## Use

1. Run the `setup-alias.sh`
2. Open the config of repository you want to set the key path of: `repoName/.git/config`
3. Add the following to it, replacing `$HOME/.ssh/key-name` with your key path
```bash
[SSH]
    keypath = $HOME/.ssh/key-name
```
You can now push and pull as normal but Git will use the key you have specified

## How It Works

All that happens is the alias looks for the config variable `SSH.keypath` and if found exports the value of the config
entry to an environment variable named `GIT_SSH_COMMAND`. Git uses this when it does anything SSH related and will make
use of the key you configured.

## Requirements

Git v2.3 or above