1

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 git@gitee.com , 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.
git@gitee.com: 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!

torek
  • 448,244
  • 59
  • 642
  • 775
Wu-Yikun
  • 35
  • 8

2 Answers2

3

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  "xxxxx@xxxxx.com"  -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 git@gitee.com

Finally, in the root folder of your local repository:

git remote set-url origin giteee:<me>/<myProject>
Wu-Yikun
  • 35
  • 8
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I tried it, but it didn't work.. I finally solved it thanks to your answer. It inspired me. Just to create a `config` file in `~/.ssh/` directory like what you said. But the content is a litter different. `Host gitee.com HostkeyAlgorithms +ssh-rsa PubkeyAcceptedAlgorithms +ssh-rsa` Thanks a lot! guy! I edit it, and you can have a see~ – Wu-Yikun Nov 05 '21 at 07:50
  • This is my first time asking questions. I'm new here and earned 15 reputation just now. And I give u a upvote and accept it at the moment. I'm still figuring out how to use this community. Thanks~ – Wu-Yikun Nov 05 '21 at 08:07
  • 1
    @Wu-Yikun You got it. Welcome to Stack Overflow. – VonC Nov 05 '21 at 08:10
1

If you tried ed25519 the first time, maybe add

Host gitee.com
    IdentityFile ~/.ssh/id_ed25519

to ~/.ssh/config should work.

roachsinai
  • 527
  • 5
  • 14