Fix git push fail v2.md

Fix git push fail v2

Several months ago, I wrote a blog about how to Fix-git-push-fail.

But now, I acidentally found that I didn’t spelled my email address correctly in the git config (Because I found that I can’t access a newly create private repo on GitHub, and the commit user seems differ from the one I farmiliar with).
Which caused conflict between my local ssh key and the one in the GitHub account.

So, a easier way to fix this problem is to change git config

1
2
git config --global user.email "your_email@example.com"
git config --global user.name "your_name"

And we may also need to point to the correct ssh key for github.

1
vi ~/.ssh/config

Add the following content:

1
2
3
Host github.com
HostName github.com
IdentityFile=/home/dyliu/.ssh/id_ed25519_gmail

We can try

1
ssh -T git@github.com

to test if the ssh key is correct.


Fix git push fail v2.md
https://dyliu0312.github.io/blog.github.io/2025/10/20/Fix-git-push-fail-v2/
Author
dyliu
Posted on
October 20, 2025
Licensed under