dcparham
dcparham

Reputation: 291

Permission denied (publickey). Could not read from remote repository.

my apologies but i am at a loss. i tried following other instructions to no avail, and hope my post is clear enough that i will get good concise steps how to resolve:

i have a file test1.php in folder x. i have a Git Bash dialog opened in x/test1.php. here is some meta info; and i run the following commands with these results:

i have git version 2.12.1.windows.1. i created ssh key, named it id_rsa in .ssh folder:

ssh-add ~/.ssh/id_rsa

results in msg - Identity added in Users/profile/.ssh/id_rsa.

git push origin

results in msg - current branch master has no upstream branch, do this.... git push --set-upstream origin master results in Permission denied (publickey)...could not read from remote repo. furthermore, any attempts to follow through, not working....

git add test1.php
git commit -m "commit" test1.php
git push origin

then i get msg, "current branch master has no upstream branch...do this:"

git push --set-upstream origin master

that results in message: Permission denied (publickey). Could not read from remote repository. Please make sure you have access rights and the repo exists.

i generated an ssh private key earlier and added it, seemingly without incident. can you tell what is going wrong? can someone list simple, incremental steps on the natural order of the environment that makes this thing work?

i know there are other posts for this, i have read through them, and tried the collective things recommended. even if you could just point me to a post where things are sequentially laid out i could read that. any help, many thanks!!

Upvotes: 2

Views: 2723

Answers (1)

VonC
VonC

Reputation: 1328332

If git remote origin does show you an ssh url like git@aserver:auser/arepo, do test:

ssh -Tv git@aserver

You will see where ssh is looking for the public/private key. It should typically be %USERPROFILE%\.ssh\id_rsa

I have added other debugging tips here and in this answer.

Upvotes: 2

Related Questions