I want to push my code to the GitHub repo but every time it shows me the same issue.
I tried to fix it but it is still there.
I have also added an SSH key to my GitHub account but no luck yet.
Hello there!
Sometimes when using the SSH key one run into problems. I had the same problem before, I deleted all my SSH keys and generated a new one and it worked, you can try the same but I do not guarantee you success.
Other than the ssh, you can use the https link provided. It used to work for me when I could use the ssh key.
I’m also not near my computer, I’ll help more when I get to it.
I have tried both ways to fix it but nothing works.
This is the documentation I read when I had this problem. I cleared my SSH keys and started the process with the guidance of this documentation.
@stephenmutheu I have tried the steps explained in the documentation but did not get the result.
Please screenshot the .ssh directory so we can see the files.
Also screenshot the error
@hbar1st Here it is:
What command did you use to create the ssh key?
- Google the error message you’re seeing on console and you will get the answer
- YT search for “learn git and github for beginners”. Choose one the popular videos and complete it ( along with taking notes ofcourse )
@hbar1st I have followed this documentation to generate ssh key
have you done this step?
- In a terminal window without elevated permissions, add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_ed25519 in the command with the name of your private key file.
ssh-add c:/Users/YOU/.ssh/id_ed25519
You can also try using the GitHub CLI. If you run gh auth login
and use the default authentication mode, it will use a web-flow for it.
@hbar1st I have try to add the ssh key in this format but not working yet.
this means that you haven’t started the agent properly yet.
Open a Windows Powershell but use Run As Administrator to open it.
Then run the commands:
Get-Service -Name ssh-agent | Set-Service -StartupType Manual
Start-Service ssh-agent
then close the powershell and go to a normal (not elevated) powershell
and run the ssh-add command I gave you earlier.
if it works it will show something like
PS C:\Users\USER\.ssh> ssh-add c:/Users/USER/.ssh/id_ed25519
Enter passphrase for c:/Users/USER/.ssh/id_ed25519:
Identity added: c:/Users/USER/.ssh/id_ed25519 (your-email-address)
make sure you use the correct ssh file name that you have which is id_rsa (not id_ed25519)
@hbar1st I have tried the mentioned commands and it is showing the same you said but still by code is not pushing to GitHub and showing me the same error as before.
It is great that you added the key to the agent but did you do the rest of the steps mentioned in the document?
For eg. Did you add the key contents to GitHub?
@hbar1st Yes, I have already completed the steps mentioned in the documentation.
Can you try the steps again starting with deleting the key that was in you GitHub account then adding back the new one you made ?
Instructions below