Answer the question
In order to leave comments, you need to log in
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
git clone [email protected]:/repo_dir/
add an .ssh/config
entry 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
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.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question