1

I am trying to push the code from the repository when I encountered this error:

No anonymous write access.

I have followed the steps mentioned in Git push from Visual Studio Code: "No anonymous write access. Authentication failed", but still, I got the same error.

I need some clarifications for the process mentioned in that question.

After doing the cat ~/.ssh/id_ed25519.pub, I saw the key in the format

ssh-ed25519 <key> <email>

Do I need to copy the whole thing in the key field of GitHub account like key+email or only key?

Enter image description here

Is there another solution too apart from the clarification?

I copied all the content as per the answers I received. But then, I changed my remote from a https to a ssh link, and then I am getting this error while pushing:

sign_and_send_pubkey: signing failed: agent refused operation
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
MagnusEffect
  • 3,363
  • 1
  • 16
  • 41
  • There is now a candidate for the canonical question for this update scandal: *[fatal: Authentication failed for](https://stackoverflow.com/questions/69979522/)* (despite the unspecific title) – Peter Mortensen Nov 18 '21 at 16:17

3 Answers3

3
  1. Clarified: Copy the whole thing in the key field of the GitHub account.

    ssh-ed25519 <key> <email>

  2. If the error still persists after following the tutorial given in the link, then change the remote of the repository from https to ssh using

    git remote set-url origin [email protected]:<username>/<reponame>.git
    
  3. Now if you encounter the error

       sign_and_send_pubkey: signing failed: agent refused operation
       [email protected]: Permission denied (publickey).
       fatal: Could not read from remote repository.
       Please make sure you have the correct access rights and the repository exists.
    

    Never forget to add the SSH key from where you are pushing the code:

     ssh-add
    
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
MagnusEffect
  • 3,363
  • 1
  • 16
  • 41
0

Copy everything as it is from your public key something.pub to the key section of the GitHub SSH settings page.

The key should be like this: ssh-rsa <key> <username>@<machine_name>

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ruben
  • 558
  • 3
  • 15
0

You can read here to test your SSH connection before pushing your code to remote: Test SSH connection on GitHub

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
NIK
  • 1