Yesterday I found out about existence of such thing as git.I need to access a remote repository with ssh.I used command $ git clone git@forest.com:stranger@gmail.com
. But when I use this , it says it's cloning and then requires a password. Though I have secret and pub keys in ~/.ssh.And also I have a config file, that looks like this:
Host forest
User git
HostName forest.com
Port 22
IdentityFile ~/.ssh/<stranger@gmail.com>.key
Can you ppl give me a tip, how can I access this remote repository and why I need this config file, and what can I do with it?
Since your key has no standard name, you need to use your config file.
But the exact url for that would be:
git clone forest:yourRepo
The key "forest
" reference the Host entry in your ~/.ssh/config
file, which will provide ssh with the right user, hostname, port and private key file to use.
YourRepo
should be the name or the full path of the repo you want to clone.
I doubt your repo is named stranger@gmail.com
.
The other issues are:
the name of the config file:
no extension needed: ~/.ssh/config
only. Anything else will be ignored by ssh.
the name of your private key:
I strongly suggests avoiding the '@
' in it, and using a full path: /home/myName/.ssh/myKey
and /home/myName/.ssh/myKey.pub
(for private and public keys).
Then your IdentityFile
should reference the key without any extension: /home/myName/.ssh/myKey
: that is the private one (as opposed to the public one: /home/myName/.ssh/myKey.pub
).