kame
kame

Reputation: 21990

Can't push to github with working ssh-key

This code:

sudo git push -u [email protected]:myusername/wolke master

give me this error:

Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

I checked my ssh-key. It is the same like in github.

How to check If the repository exists? I init a repository with git init, so it should exist.

What else can I do?

Solution: Don't use sudo!

git push -u [email protected]:myusername/wolke master

Upvotes: 2

Views: 1017

Answers (1)

melpomene
melpomene

Reputation: 85887

Because when you're using sudo, git is running as root and thus uses root's ssh keys. Without sudo you're using your own keys, so everything works as expected.

Upvotes: 2

Related Questions