Quantcast
Channel: How to tell git which private key to use? - Super User
Browsing all 26 articles
Browse latest View live

Answer by user2965205 for How to tell git which private key to use?

All of the answers above are correct, but they all fail, when using something like terraformImaginge this scenarioYou have a personal github accountYou join a new company, and create another github...

View Article



Answer by Artur Müller Romanov for How to tell git which private key to use?

For MacOS:git config core.sshCommand "ssh -i ~/.ssh/id_rsa_2"

View Article

Answer by iRestMyCaseYourHonor for How to tell git which private key to use?

Before calling your usual git commands run:eval $(ssh-agent)ssh-add ~/.ssh/your_spesific_private_key

View Article

Answer by Dmytro Buryak for How to tell git which private key to use?

This is my setup for multiple accounts, each using separate rsa key. It doesn't matter whether it's github, bitbucket, or whatever; this setup is not touching ssh client config, neither it uses hosts...

View Article

Answer by Andre Greeff for How to tell git which private key to use?

There are already a great many proposed solutions here, including numerous options working around the GIT_SSH_COMMAND environment variable, many of which I've actually used myself over the...

View Article


Answer by Maddes for How to tell git which private key to use?

All the information up to now (2020-01) are useful, but IMHO are a little bit messy, and no post sums them up to a clean solution.So here are my solutions. If you are lucky with your current solution,...

View Article

Answer by nyxz for How to tell git which private key to use?

If you need to connect to the same host with different keys then you can achieve it by:Configure the ~/.ssh/config with different Hosts but same HostNames.Clone your repo using the appropriate...

View Article

Answer by Yordan Georgiev for How to tell git which private key to use?

# start :: how-to use different ssh identity files # create the company identity file ssh-keygen -t rsa -b 4096 -C "first.last@corp.com" # save private key to ~/.ssh/id_rsa.corp, cat...

View Article


Answer by Srikrushna for How to tell git which private key to use?

When you have multiple git account and you want different ssh keyYou have to follow same step for generating the ssh key, but be sureyoussh-keygen -t ed25519 -C your-email-id@gmail.comEnter the path...

View Article


Answer by dtmland for How to tell git which private key to use?

While the question doesn't request it, I am including this answer for anyone else looking to solve the same problem just specifically for gitlab.The gitlab solutionI tried using the...

View Article

Answer by Brendan Baldwin for How to tell git which private key to use?

So I set the GIT_SSH env variable to $HOME/bin/git-ssh.In order to support having my repo configuration dictate which ssh identity to use, my ~/bin/git-ssh file is this:#!/bin/shssh -i $(git config...

View Article

Answer by Jinmiao Luo for How to tell git which private key to use?

Just use ssh-agent and ssh-add commands.# create an agentssh-agent# add your default keyssh-add ~/.ssh/id_rsa# add your second keyssh-add ~/.ssh/<your key name>After executing the above commands,...

View Article

Answer by akjprajapati for How to tell git which private key to use?

I'm using git version 2.16 and I don't need a single piece of script not even a config or modified commands.Just copied my private key to .ssh/id_rsaset permissions to 600 And git reads to key...

View Article


Answer by miguelmorin for How to tell git which private key to use?

I build on @shellholic and this SO thread with a few teaks. I use GitHub as an example and assume that you have a private key in ~/.ssh/github (otherwise, see this SO thread) and that you added the...

View Article

Answer by Michael Cole for How to tell git which private key to use?

I had a client that needed a separate github account. So I needed to use a separate key just for this one project.My solution was to add this to my .zshrc / .bashrc:alias infogit="GIT_SSH_COMMAND=\"ssh...

View Article


Answer by thucnguyen for How to tell git which private key to use?

Use custom host config in ~/.ssh/config, like this:Host gitlab-as-thuc HostName github.com User git IdentityFile ~/.ssh/id_rsa.thuc IdentitiesOnly yesthen use your custom hostname like this:git remote...

View Article

Answer by Zaz for How to tell git which private key to use?

Generally, you want to use ~/.ssh/config for this. Simply pair server addresses with the keys you want to use for them as follows:Host github.com IdentityFile ~/.ssh/id_rsa.githubHost heroku.com...

View Article


Answer by Salsicha for How to tell git which private key to use?

My solution was this:create a script:#!/bin/bashKEY=dafault_key_to_be_usedPORT=10022 #default port...for i in $@;do case $i in --port=*) PORT="${i:7}";; --key=*)KEY="${i:6}";; esacdoneexport...

View Article

Answer by flaviovs for How to tell git which private key to use?

If you do not want to have to specify environment variables every time you run git, do not want another wrapper script, do not/can not run ssh-agent(1), nor want to download another package just for...

View Article

Answer by Jan Vlcinsky for How to tell git which private key to use?

After my struggle with $GIT_SSH I would like to share what worked for me.Through my examples I will assume you have your private key located at/home/user/.ssh/jenkinsError to avoid: GIT_SSH value...

View Article
Browsing all 26 articles
Browse latest View live




Latest Images