How to execute a Git command using custom private key

By default, when running Git command on repositories accessed via SSH, Git uses your default private key, i.e. /.ssh/id_rsa. Suppose you have multiple SSH keys and you want Git to use a specific non-default one to perform a command, you may do this using a command like

GIT_SSH_COMMAND="ssh -i ~/.ssh/your_rsa_key" git push origin master

Note that you need Git 2.3 and newer.


How to tell git which private key to use?

How to install a Github package using pip

Suppose you are working on a Python project and want to quickly install a public package from Github, you can do this using a command like:

pip install -e git://

If the repository is private and your SSH private key has been added to the repository’s access list, then you can access it using a command like:

pip install -e git+ssh://