Question

How To Set Up Automatic Deployment with Git with a VPS

As I was following through the tutorial on the same topic (https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps), I successfully established a git repo at the vps, I even added remote live by git remote add live ssh://myuser@mydomain.com/var/repo/site.git I already have local git setup I regularly use git with my team.

But when I used the command git push live vps The following happened

The authenticity of host 'mydomain.com (1xx.yy.www.zz3)' can't be established.
ECDSA key fingerprint is SHA256:yXzYFN698CZQgNHzb8jg4CQCIJBhzD34AFebkZ0/63Q.
Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'mydomain.com,1xx.yy.www.zz3' (ECDSA) to the list of known hosts.

myuser@mydomain.com.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I was kind of expecting it to come since there is no step I can see where I may put my private ssh key. Please note that I am using putty with ssh key to communicate with my server and using windows cmd to issue git commands git remote add live ssh://myuser@mydomain.com/var/repo/site.git and git push live vps

from my local system.

Please let me know where I am missing something.


Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello,

Just came across this question. You would need to add your public SSH key to the /home/myuser/.ssh/authorized_keys file.

Also, you need to make sure that the authorized_keys file has 600 permissions:

chmod 600 /home/myuser/.ssh/authorized_keys
chmod 700 /home/myuser/.ssh

And then if this is still happening, then you could try adding the -vvv flag when trying to connect via SSH.

This will give you some extra information on why the connection is failing.

Best, Bobby