Sankalp
Sankalp

Reputation: 1128

Git: Permission Denied

I am trying to set up git as a first time user and proceeded as in the following tutorials:

Setting up git

and now I am stuck at step 5 so i tried the SSH issues at github SSH issues. I have generated all the keys and are placed in C:\Users\Admin.ssh as File Layouts Upon trying for

ssh -vT github.com 

I am getting Permission denied error though I have pasted the id_dsa at github. I have disabled the firewall(was blocking port 22 earlier) and edited config as:

Host github.com
User git
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile C:\Users\Admin\.ssh\id_dsa
Port 443 

enter image description here

What wrong am i doing here??

Upvotes: 0

Views: 3861

Answers (4)

tierfour
tierfour

Reputation: 682

In your C:\Users\someuser.shh\ dir there should be only one id_rsa and id_rsa.pub. The .pub key is the one you upload to github.

What I would do, assuming github is the only git server you are connecting to, is delete all o the id_rsa files and start over with a fresh set using:

ssh-keygen -t rsa -C "[email protected]"

accept the default name.

The config file is used to identify the check in but the emails should match what you intend to use.

Upvotes: 0

Kitsune
Kitsune

Reputation: 9341

You're using the wrong file, you need to upload the public key, which ends in .pub. Since Windows is hiding the file extensions by default, you can tell which is the .pub file because Windows is claiming it's a "Microsoft Office P..." filetype (I assume Publisher).

Open the file in a text editor such as Notepad, and then copy that data to GitHub. The other is your private key which you should never share with anyone else.

Upvotes: 1

malexmave
malexmave

Reputation: 1300

Disclaimer: I have never used github, all my knowledge comes from using a git I set up on my own NAS.

I might be wrong, but from what I am reading, you are trying to authenticate using the file you pasted into github. This is wrong, because you have one public and one private part of your keypair. You paste the public part into github und authenticate using the private part.

dsa and rsa are, as far as I remember, different algorithms used to generate keypairs.

For username issues, the next answer sais it has to be git, not your own username.

Upvotes: 0

Fred Foo
Fred Foo

Reputation: 363807

You should SSH to [email protected]. I.e., the username for SSH is always git, not your GitHub username.

You also should have pasted id_dsa.pub into GitHub. You should really generate new keys, since now your private key has been compromised.

Upvotes: 3

Related Questions