azure SSH permision denied (public key) - Git

Anonymous
2022-07-16T18:36:22.63+00:00

Good afternoon, I have a problem when pushing to a remote repository on the azure vm. I configured the ssh key between the vm and my computer, I can only connect via ssh (passing the server user) with the command: ssh -i <private key path> user@vmip. Everything ok so far, the problem is when I give git push, I get the error of permission denied (public key). I've already run the commands eval $(ssh-agent), ssh-add ~/.ssh/my key and it still doesn't send the push. I need help as I use the student plan to test my study projects, if anyone can help me I would be very grateful. Thanks.

221491-image.png

The push is done from my machine to vm directly, with googlecloud I never had any problems.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,014 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,933 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Cristian SPIRIDON 4,486 Reputation points Volunteer Moderator
    2022-07-17T05:06:20.93+00:00

    Hi,

    There is a stackoverflow answer that explain what you need to do to get git working with ssh:

    https://stackoverflow.com/questions/4565700/how-to-specify-the-private-ssh-key-to-use-when-executing-shell-command-on-git

    I would prefer the first answer with updating .ssh/config file.
    But there is a possibility to have this without .ssh/config but you need to issue a much longer cmd line. (See the second response)

    Hole this helps!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.