0

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.

rablentain
  • 6,641
  • 13
  • 50
  • 91
  • http://serverfault.com/questions/194567/how-do-i-tell-git-for-windows-where-to-find-my-private-rsa-key – Mircea Jun 25 '15 at 01:26

1 Answers1

0

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
    
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250