Reputation: 198
I have an IP and guest_key
from a live linux server.
I am getting error when I try to ssh into the server or use push on it.
Every time I try, I get a Permission denied (publickey)
error i
I have tried to push my local Git app into production by ssh like below
git remote add production ssh://root@3******0/var/repo/site.git
how can I add my key to git bash line so that server gives me permission.
I am using windows and git bash for that.
root@**MyIpAdress**: Permission denied (publickey).
Can somebody help me with that: I mean can we directly ssh into live server or just by pushing by Git ?
Upvotes: 1
Views: 523
Reputation: 1323943
First, it would be really surprising to be using the root
account for a remote SSH session.
This is not considered a good practice (since root
can do anything), and a service account like "git
" (or any regular account you want) is recommended.
Second, you need to add your %USERPROFILE%\.ssh/id_rsa.pub
to the remote server ~/.ssh/authorized_keys
, in order for any SSH call to have a chance to complete.
If your key is not named id_rsa(.pub)
, then, as explained here, you need to define an entry (for instance 'xxx') which will reference your actual private key.
Then your URL would be:
cd C:\path\to\repo
git remote set-url production xxx:/var/repo/site.git
git push production master
But again, try and avoid using root
on the remote server.
(even sudo
is dangerous)
Upvotes: 1