I am connecting to my virtual machine with ssh like this:
ssh -i keyfile.key user@server.com
I have created a git repository on the server which I want to push to, but I do nott know how I should use the keyfile.key with git.
I am supposed to execute the command:
git push live master
But I getting the error "permission denied (publickey)", so how do I specify the key? I am on Windows 8.
You need to:
use a, ~/.ssh/config
( check where %HOME%
is set , since you are on Windows).
The config file would look like (replace <hostkey>
by any string you want)
Host <hostkey> HostName myserver User user IdentityFile C:\\path\\to\\.ssh\\keyfile.key IdentitiesOnly yes
change your remote url to one using the config Host key
git rmeote set-url list <hostkey>:myrepo
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.