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
git@github.com: 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 git@github.com:<username>/<reponame>.git
    
  3. Now if you encounter the error

       sign_and_send_pubkey: signing failed: agent refused operation
       git@github.com: 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
  • It is like `ssh-ed25519 ` in my case. – MagnusEffect Nov 14 '21 at 13:37
  • not sure if git support Edwards methods of ssh. – Ruben Nov 14 '21 at 13:41
  • found this article [reference](https://gist.github.com/hrdtbs/ba50868d7d608b89f958fe32dc35fdd4) – Ruben Nov 14 '21 at 13:43
  • I refer from here https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent to generate the key. – MagnusEffect Nov 14 '21 at 13:45
  • So for the reference you share , I copied already from here,but then I changed my remote from `https` to `ssh` link , then I am getting this error while pushing. `sign_and_send_pubkey: signing failed: agent refused operation git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.` – MagnusEffect Nov 14 '21 at 13:49
  • was the key generated for the user is same user you use to push the code to remote repo? – Ruben Nov 14 '21 at 13:55
  • Yes @ruben, since I don't have any other key exisiting. – MagnusEffect Nov 14 '21 at 14:02
  • Solved the issue @ruben, solution will be posted in answers section. – MagnusEffect Nov 14 '21 at 14:16
  • Was ssh-add does the work? – Ruben Nov 14 '21 at 14:55
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