Question

i how can i solve this error "Permission denied (publickey)." when i typed "git push live master" ???

i try to deploy my project on digitalocean hosting , i follow this link , http://www.refactoru.com/blog/setting-up-push-to-deploy-on-digitalocean every thing is ok , but when i typed "git push live master " on git bash on my local repo i get error $ git push live master Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. i searched for this problem and tried many solution but it didnot work, notes : i work on windows OS , so i can connect to ubuntu digitalocean server with putty without any problem … i know the problem related with authentication , but i don’t know how i solve it ??? plz help me… thanks

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

thanks a lot xMudrii for your response , but can you tell me if my thinking is correct or not : when i added live brunch i gave it the path on the Ubuntu hosting server like this : git remote add live root@x.x.x.x:/opt/adviser.git where x.x.x.x is Ubuntu hosting server IP Address so when i typed git remote -v i get : live root@x.x.x.x:/opt/adviser.git (fetch) live root@x.x.x.x:/opt/adviser.git (push) origin https://github.com/myname/adviser.git (fetch) origin https://github.com/myname/adviser.git (push) is that correct , i add remote brunch with my hosting server path depend on this link https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps please help , i need any idea that help me …

Make sure you set remote location correctly. What does Git service you use? Is it GitHub or something other? To check did you set remote location correctly, execute git remote -v in project directory (in same directory you did git push live master).

  1. git remote -v

If you use GitHub, output should be like one of this two:

Example output 1 - Remote listing - Git
live  	https://github.com/your-github-username/repo-name (fetch)
live  	https://github.com/your-github-username/repo-name (push)
Example output 2 - Remote listing - Git
live  	git@github.com:your-github-username/repo-name (fetch)
live  	git@github.com:your-github-username/repo-name (push)

In case of first output, you should be asked for username and password once you try push. For second, make sure you have set up SSH keys correctly. If you don’t have SSH key, you can follow GitHub guide to do so. If you use GitHub and don’t match above pattern, you made some mistake. Also, once again, make sure you typed your username and repo name correctly.

For The access Denied Issues And git username , password

I had this problem too but managed to solve it, the error is that ur computer has saved a git username and password so if you shift to another account the error 403 will appear. Below is the solution For Windows you can find the keys here:

control panel > user accounts > credential manager > Windows credentials > Generic credentials

Next remove the Github keys.

yes, error is Permission denied (publickey) i can connect to server from putty and ssh key is accepted but when i connect from git bush , i get this error … what can i do ? i think my ssh keys configuration is correct … when i use this command : $ ssh -v root@x.x.x.x OpenSSH_7.1p2, OpenSSL 1.0.2h 3 May 2016 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Connecting to x.x.x.x[x.x.x.x] port 22. debug1: Connection established. debug1: key_load_public: No such file or directory debug1: identity file /c/Users/DELL/.ssh/id_rsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /c/Users/DELL/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /c/Users/DELL/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /c/Users/DELL/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /c/Users/DELL/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /c/Users/DELL/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /c/Users/DELL/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /c/Users/DELL/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_7.1 debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 pat OpenSSH_6.6.1* compat 0x04000000 debug1: Authenticating to x.x.x.x:22 as ‘root’ debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ecdsa-sha2-nistp256 SHA256:NjWN9e7YUzgW8nluM9DYyrfQQ5dNwJImkhfI6nBpccY debug1: Host ‘x.x.x.x’ is known and matches the ECDSA host key. debug1: Found key in /c/Users/DELL/.ssh/known_hosts:4 debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Trying private key: /c/Users/DELL/.ssh/id_rsa debug1: Trying private key: /c/Users/DELL/.ssh/id_dsa debug1: Trying private key: /c/Users/DELL/.ssh/id_ecdsa debug1: Trying private key: /c/Users/DELL/.ssh/id_ed25519 debug1: No more authentication methods to try. Permission denied (publickey).

i save my private key as c/Users/DELL/.ssh/id_rsa but it dose not work , what can i do ?? i appreciated your help … this is my first experiment as web developer

Hello there.

It should be correct. In case of Hooks, this is how you want to do it. First I would verify, do you have access to Ubuntu Server from Git Bash. To do so, use ssh command:

  1. ssh root@droplet-ip

If that doesn’t show error (for example Permission denied (publickey).), that means this part is OK. However, if error appears, make sure you have configured correctly SSH key on server and on client.

In case this is not a problem, make sure you created repository on Ubuntu Server correctly. You could use How To Use Git Hooks To Automate Development and Deployment Tasks instead of DO tutorial you linked in answer, as this is newer.