github somehow used my non ssh connected global account in a repo where my ssh github account was a collaborator #157942
-
|
I have a global GitHub connection on my local machine. I recently added an SSH connection for a different GitHub account and used it to SSH-clone a repository onto my local machine. However, when I pushed my changes, I forgot to update my local username to match my SSH account, meaning GitHub recognized my global (old) account instead of the SSH-connected one. As a result: GitHub used my global account to push changes, even though it wasn’t a collaborator on that repository. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
|
You're dealing with a Git + GitHub identity conflict caused by mixing global Git configuration (user/email) and SSH keys from two different GitHub accounts. This situation has led to unexpected behavior, including: Your global GitHub account being added as a collaborator (or contributor) to a repo it wasn’t originally tied to. You’re unable to remove yourself from the repo’s “Code,” “Planning,” or “Automation” sections, because GitHub’s UI reflects access based on the repo being listed under a different (SSH-authenticated) account. GitHub accepted your push because the SSH key matched a user who had push access, but Git used the global user.email/name, confusing attribution. |
Beta Was this translation helpful? Give feedback.
-
|
Is it fixable issue? Or, one can just ask the repo owner to manually remove the contributors somehow? I doubt even the owner will be able to remove that, but if he can remove the collaborator under my ssh connected account for the repo, would the global masked account who somehow got into the collaborator/contributor section would be removed? |
Beta Was this translation helpful? Give feedback.
-
|
you can try this tool for simplify flow |
Beta Was this translation helpful? Give feedback.
Fixing the Problem
✅ A. If You Were Added as a Collaborator (with access)
Yes, the owner can remove you:
Go to Repo Settings → Collaborators and Teams
Find your global (Account A) username
Click Remove
👉 This completely removes your access.
This cannot be removed manually. GitHub shows contributors based on email in commits, and only rewriting Git history (or force-pushing rewritten commits) removes a contributor from that list.
➤ How to Remove Yourself as Contributor:
Repo owner must:
Rewrite commit history with correct author info (using git filter-branch or git rebase)
Force-push updated history to GitHub
Optionally, delete t…