Wu-Yikun
Wu-Yikun

Reputation: 55

[email protected]: Permission denied (publickey), not a common problem, to be solved

About publickey: I configured it a year ago and it works fine!

enter image description here

However, I can't push to any gitee repositories from yesterday.

Permission denied (publickey)

But it works well in github?! (I'm sure I'm using the same publickey and it was added before)

enter image description here

After running $ ssh -Tvvv [email protected] , I got the following message:

enter image description here

# other infos
debug1: Trying private key: /c/Users/57715/.ssh/id_dsa
debug3: no such identity: /c/Users/57715/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /c/Users/57715/.ssh/id_ecdsa
debug3: no such identity: /c/Users/57715/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /c/Users/57715/.ssh/id_ecdsa_sk
debug3: no such identity: /c/Users/57715/.ssh/id_ecdsa_sk: No such file or directory
debug1: Trying private key: /c/Users/57715/.ssh/id_ed25519
debug3: no such identity: /c/Users/57715/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: /c/Users/57715/.ssh/id_ed25519_sk
debug3: no such identity: /c/Users/57715/.ssh/id_ed25519_sk: No such file or directory
debug1: Trying private key: /c/Users/57715/.ssh/id_xmss
debug3: no such identity: /c/Users/57715/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey).

I've been searching for that answer all day, could somebody help to solve the tough problem?

I would appreciate it very much!

Upvotes: 1

Views: 1230

Answers (2)

roachsinai
roachsinai

Reputation: 536

If you tried ed25519 the first time, maybe add

Host gitee.com
    IdentityFile ~/.ssh/id_ed25519

to ~/.ssh/config should work.

Upvotes: 1

VonC
VonC

Reputation: 1324977

First, if this was working before, that would mean you are sharing one SSH key between multiple destinations, which is not a good practice.

As explained in "Generate/add SSH public key", I would generate a new key dedicated for gitee access/authentication

cd %USERPROFILE%\.ssh
ssh-keygen -t ed25519 -C  "[email protected]"  -P "" -f gitee

Note the recommended protocol here: ed25519. rsa might no longer be allowed.

Copy the generated ssh key, and add the generated public key to the warehouse via "Management" -> "Deployment Public Key Management" -> "Add Deployment Public Key" on the warehouse homepage .

https://images.gitee.com/uploads/images/2018/0814/233212_29a62378_551147.png

Then create a %USERPROFILE%\.ssh\config file, with in it:

Host gitee.com 
HostkeyAlgorithms +ssh-rsa 
PubkeyAcceptedAlgorithms +ssh-rsa

Test this is working with ssh -T [email protected]

Finally, in the root folder of your local repository:

git remote set-url origin giteee:<me>/<myProject>

Upvotes: 3

Related Questions