K
K
ksvdon2014-03-28 12:53:26
linux
ksvdon, 2014-03-28 12:53:26

How to explicitly specify a private key when working with git

I generated the key on my machine, and now I need to work on the other. There is a key. I added it to ~/.ssh/ on a new machine, but alas, this is clearly not enough. I wonder how you can explicitly tell the machine the key to perform git clone?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
kompi, 2014-03-28
@ksvdon

git clone [email protected]:/repo_dir/
add an .ssh/configentry for the server host with the necessary connection parameters, for example:

Host gitrepo
HostName server
User git
IdentityFile ~/.ssh/private_key
IdentitiesOnly yes
PasswordAuthentication no

J
jcmvbkbc, 2014-03-28
@jcmvbkbc

Generate a key pair (public-private) on the new machine and add another public key to access the repository. Using the same private key on multiple machines is bad practice.

M
Maxim Moseychuk, 2014-03-28
@fshp

ssh-add ~/.ssh/privkey

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question