Git push still linked to old Github account #41882
Replies: 9 comments 16 replies
-
I prefer to remove the previous git repo using or do a clone of the previous git repo and push in the new GitHub account. |
Beta Was this translation helpful? Give feedback.
-
It sounds like you have credentials for your old account configured, you'll need to remove those and then provide credentials for your new account. Exactly how to do that depends on your OS, configuration, and the protocol (HTTPS or SSH) you're using to push.
|
Beta Was this translation helpful? Give feedback.
-
Same error is coming even after i changed the config --global user.name and user.email |
Beta Was this translation helpful? Give feedback.
-
What if it's not even asking pass
…On Sun, 19 Mar 2023, 16:27 Airtower, ***@***.***> wrote:
No, I'm talking about what you enter (and possibly cache) when Git asks
for your username and password e.g. on git push (if you're using HTTPS),
or your SSH setup (if you're using SSH). The token gh acquires should
work for Git push/fetch operations too, though.
—
Reply to this email directly, view it on GitHub
<#41882 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3ZLPT2VE2B2X5SFD3KP7BTW43RA5ANCNFSM6AAAAAATALPLWM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
created a new GitHub account and did a git push --setup-upstream origin after I added my origin branch. After deleting my old GitHub credentials under Credential Manager in Windows, it seemed to be working fine, was getting the GitHub-sign-in window from Visual Studio Code to sign in and used new account credentials. Once I did git push to push my project upstream, my GitHub now tells me my old account had pushed the project into my new account's branch... How is that possible? I don't have any SSH or other tokens assigned from my old account so that is the confusing part. I also can't seem to find a solution to "log out" or get rid of my old GitHub from upstreaming this to my new account. Is there something I am missing? |
Beta Was this translation helpful? Give feedback.
-
something that has worked for me in the past is: recreating the whole process to create a new I frequently use different |
Beta Was this translation helpful? Give feedback.
-
It appears that you're encountering permission issues when pushing to a GitHub repository after changing your username and email. The error message you're seeing, "Permission to new-account/project denied to old-account," indicates that Git is still trying to use your old account credentials when interacting with the repository. Here are steps to resolve this issue:
After following these steps, you should be able to push to your GitHub repository using your new account credentials without encountering the permission error. If you continue to experience issues, please provide more details about the specific error message, and I'll be happy to assist further. |
Beta Was this translation helpful? Give feedback.
-
I had a credential problem too. Here how I solved:
|
Beta Was this translation helpful? Give feedback.
-
I don't know if you use HTTPS, SSH, or GitHub CLI, and I don't know the exact working of HTTPS and GitHub CLI, but in the case of SSH it's not enough that the author of the commit is the same username, you need to have configured the ssh key in the keys section of your profile. You must first generate a key with the command: |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Product Feedback
Body
I made a new github account with a different username and email. When trying to push a commit on a project, git said
ERROR: Permission to new-account/project denied to old-account.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Checking git log shows this
commit d830f86a4c04c0b8b620b1266b3121faf9daeea8 (HEAD -> main)
Author: name email@gmail.com
Date: Thu Dec 15 18:46:13 2022 -0800
commit 659e5fcff2cc18f5c187fa5d139a951672a14871 (origin/main, origin/HEAD)
Author: name email@users.noreply.github.com
Date: Thu Dec 15 16:41:50 2022 -0800
So then I tried changing the user.email to the email@users.noreply.github.com just in case but after trying to push again it still shows the first message.
Is there anything else I can do to fix this?
Beta Was this translation helpful? Give feedback.
All reactions