git pushes with wrong user from terminalRemove credentials from GitGit pushing to remote GitHub repository as wrong usergit push is pushing to the wrong repoGitHub push still in my old accountHow to remove local (untracked) files from the current Git working tree?How to clone all remote branches in Git?What is the difference between 'git pull' and 'git fetch'?How to undo 'git add' before commit?How do I undo the most recent local commits in Git?How do I check out a remote Git branch?How do I delete a Git branch locally and remotely?Undo a Git merge that hasn't been pushed yetHow to revert a Git repository to a previous commitHow do I rename a local Git branch?
Do Rabbis admit emotional involvement in their rulings?
Are wands in any sort of book going to be too much like Harry Potter?
Why is it wrong to *implement* myself a known, published, widely believed to be secure crypto algorithm?
Which types of fruit can I give to my dog?
Compactness in normed vector spaces.
Double underlining a result in a system of equations with calculation steps on the right side
Are on’yomi words loanwords?
Passport stamps art, can it be done?
Can I bring back Planetary Romance as a genre?
Origins of the "array like" strings in BASIC
Which spells are in some way related to shadows or the Shadowfell?
Can a planet still function with a damaged moon?
What dice to use in a game that revolves around triangles?
How do I minimise waste on a flight?
Why do 3D printers have only one limit switch?
What replaces x86 intrinsics for C when Apple ditches Intel CPUs for their own chips?
Company stopped paying my salary. What are my options?
Row vectors and column vectors (Mathematica vs Matlab)
if i accidentally leaked my schools ip address and someone d doses my school am i at fault
how to find out if there's files in a folder and exit accordingly (in KSH)
Was there a contingency plan in place if Little Boy failed to detonate?
How to avoid making self and former employee look bad when reporting on fixing former employee's work?
Lorentz invariance of Maxwell's equations in matter
Using wilcox.test() and t.test() in R yielding different p-values
git pushes with wrong user from terminal
Remove credentials from GitGit pushing to remote GitHub repository as wrong usergit push is pushing to the wrong repoGitHub push still in my old accountHow to remove local (untracked) files from the current Git working tree?How to clone all remote branches in Git?What is the difference between 'git pull' and 'git fetch'?How to undo 'git add' before commit?How do I undo the most recent local commits in Git?How do I check out a remote Git branch?How do I delete a Git branch locally and remotely?Undo a Git merge that hasn't been pushed yetHow to revert a Git repository to a previous commitHow do I rename a local Git branch?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have an issue with git and my terminal.
Here's a gallery to show you my issue : http://imgur.com/a/6RrEY
When I push commits from my terminal, git says I push them with another username, that's a user from my organisation (my company) with no commit at all and it seems it belongs to no one : (check gallery first pic)
But this doesn't happen when I use Github for mac, in the feed I see the commits pushed by myself.
The problem also affects my personal repositories, my terminal says that I don't have the permission to push commits on those repositories (which is obviously wrong) since it tries to push it with this user : (check gallery second pic)
Guess what ? This doesn't happen with Github for mac too.
I changed my computer to a brand new one few days ago, so I reset'ed all my ssh key of github and left only a new one generated by Github for Mac so I don't think that there's some ghost user/ssh key hidden somewhere, this hdd is brand new : (check gallery third pic)
My .gitconfig file is all clear, there's only my credentials : (check gallery fourth pic)
I really don't get it, help, StackOverflow, you're my only hope.
(My apologies for my poor Gimp skills and the Star Wars reference)
EDIT : ssh-add -l only shows the good ssh key created by github for mac and I have only one github account
EDIT2 : ssh -T git@github.com recognize me as the good user.
EDIT3 : After a few tests it looks like my terminal does the commits with my username, but pushes them with the other one, Github for mac commits and pushes with the good username.This situation happen with every repo I have/make (even new ones).
EDIT4 : In a personal repository git log --pretty="%h %an %ae" shows my good username
EDIT5 : No sign of environment variables that would override my credentials in my env. Even if I try to set those variables with the good credentials problem persists.
EDIT6 : Things work back normally if I force the user in the path of /.git/config of a repository but I don't think that's the good option : http://USER@github.com/USER/REPO.git
EDIT7 : We deleted the git user that pushed the commits for me and this brings another error : remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/USER/REPO.git/'
FINAL EDIT : I installed git with homebrew, typed git config --global push.default simple and now it takes my credentials even without forceing the user. That's strange. Thanks everybody for your help, you're great guys !
git github ssh
|
show 8 more comments
I have an issue with git and my terminal.
Here's a gallery to show you my issue : http://imgur.com/a/6RrEY
When I push commits from my terminal, git says I push them with another username, that's a user from my organisation (my company) with no commit at all and it seems it belongs to no one : (check gallery first pic)
But this doesn't happen when I use Github for mac, in the feed I see the commits pushed by myself.
The problem also affects my personal repositories, my terminal says that I don't have the permission to push commits on those repositories (which is obviously wrong) since it tries to push it with this user : (check gallery second pic)
Guess what ? This doesn't happen with Github for mac too.
I changed my computer to a brand new one few days ago, so I reset'ed all my ssh key of github and left only a new one generated by Github for Mac so I don't think that there's some ghost user/ssh key hidden somewhere, this hdd is brand new : (check gallery third pic)
My .gitconfig file is all clear, there's only my credentials : (check gallery fourth pic)
I really don't get it, help, StackOverflow, you're my only hope.
(My apologies for my poor Gimp skills and the Star Wars reference)
EDIT : ssh-add -l only shows the good ssh key created by github for mac and I have only one github account
EDIT2 : ssh -T git@github.com recognize me as the good user.
EDIT3 : After a few tests it looks like my terminal does the commits with my username, but pushes them with the other one, Github for mac commits and pushes with the good username.This situation happen with every repo I have/make (even new ones).
EDIT4 : In a personal repository git log --pretty="%h %an %ae" shows my good username
EDIT5 : No sign of environment variables that would override my credentials in my env. Even if I try to set those variables with the good credentials problem persists.
EDIT6 : Things work back normally if I force the user in the path of /.git/config of a repository but I don't think that's the good option : http://USER@github.com/USER/REPO.git
EDIT7 : We deleted the git user that pushed the commits for me and this brings another error : remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/USER/REPO.git/'
FINAL EDIT : I installed git with homebrew, typed git config --global push.default simple and now it takes my credentials even without forceing the user. That's strange. Thanks everybody for your help, you're great guys !
git github ssh
2
check~/.gitconfigand$project_root/.git/configfiles. One of those two is surely misconfigured for user name.
– mu 無
Feb 6 '14 at 22:31
1
Thanks for your answer ansh0l.~/.gitconfigis clear and so is$project_root/.git/config. In fact I have this issue with every personal project, work projects can be pushed since this other user belongs to my organisation that owns those repositories.
– Yinfei
Feb 6 '14 at 22:34
Do you have multiple github accounts then? One for company, the other for personal usage?
– mu 無
Feb 6 '14 at 22:36
Nope, only one for everything.
– Yinfei
Feb 6 '14 at 22:36
1
An annoying solution would be to just regenerate another SSH key. If you are using your current SSH key with another service it would be pointless.
– Eduardo Bautista
Feb 6 '14 at 22:40
|
show 8 more comments
I have an issue with git and my terminal.
Here's a gallery to show you my issue : http://imgur.com/a/6RrEY
When I push commits from my terminal, git says I push them with another username, that's a user from my organisation (my company) with no commit at all and it seems it belongs to no one : (check gallery first pic)
But this doesn't happen when I use Github for mac, in the feed I see the commits pushed by myself.
The problem also affects my personal repositories, my terminal says that I don't have the permission to push commits on those repositories (which is obviously wrong) since it tries to push it with this user : (check gallery second pic)
Guess what ? This doesn't happen with Github for mac too.
I changed my computer to a brand new one few days ago, so I reset'ed all my ssh key of github and left only a new one generated by Github for Mac so I don't think that there's some ghost user/ssh key hidden somewhere, this hdd is brand new : (check gallery third pic)
My .gitconfig file is all clear, there's only my credentials : (check gallery fourth pic)
I really don't get it, help, StackOverflow, you're my only hope.
(My apologies for my poor Gimp skills and the Star Wars reference)
EDIT : ssh-add -l only shows the good ssh key created by github for mac and I have only one github account
EDIT2 : ssh -T git@github.com recognize me as the good user.
EDIT3 : After a few tests it looks like my terminal does the commits with my username, but pushes them with the other one, Github for mac commits and pushes with the good username.This situation happen with every repo I have/make (even new ones).
EDIT4 : In a personal repository git log --pretty="%h %an %ae" shows my good username
EDIT5 : No sign of environment variables that would override my credentials in my env. Even if I try to set those variables with the good credentials problem persists.
EDIT6 : Things work back normally if I force the user in the path of /.git/config of a repository but I don't think that's the good option : http://USER@github.com/USER/REPO.git
EDIT7 : We deleted the git user that pushed the commits for me and this brings another error : remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/USER/REPO.git/'
FINAL EDIT : I installed git with homebrew, typed git config --global push.default simple and now it takes my credentials even without forceing the user. That's strange. Thanks everybody for your help, you're great guys !
git github ssh
I have an issue with git and my terminal.
Here's a gallery to show you my issue : http://imgur.com/a/6RrEY
When I push commits from my terminal, git says I push them with another username, that's a user from my organisation (my company) with no commit at all and it seems it belongs to no one : (check gallery first pic)
But this doesn't happen when I use Github for mac, in the feed I see the commits pushed by myself.
The problem also affects my personal repositories, my terminal says that I don't have the permission to push commits on those repositories (which is obviously wrong) since it tries to push it with this user : (check gallery second pic)
Guess what ? This doesn't happen with Github for mac too.
I changed my computer to a brand new one few days ago, so I reset'ed all my ssh key of github and left only a new one generated by Github for Mac so I don't think that there's some ghost user/ssh key hidden somewhere, this hdd is brand new : (check gallery third pic)
My .gitconfig file is all clear, there's only my credentials : (check gallery fourth pic)
I really don't get it, help, StackOverflow, you're my only hope.
(My apologies for my poor Gimp skills and the Star Wars reference)
EDIT : ssh-add -l only shows the good ssh key created by github for mac and I have only one github account
EDIT2 : ssh -T git@github.com recognize me as the good user.
EDIT3 : After a few tests it looks like my terminal does the commits with my username, but pushes them with the other one, Github for mac commits and pushes with the good username.This situation happen with every repo I have/make (even new ones).
EDIT4 : In a personal repository git log --pretty="%h %an %ae" shows my good username
EDIT5 : No sign of environment variables that would override my credentials in my env. Even if I try to set those variables with the good credentials problem persists.
EDIT6 : Things work back normally if I force the user in the path of /.git/config of a repository but I don't think that's the good option : http://USER@github.com/USER/REPO.git
EDIT7 : We deleted the git user that pushed the commits for me and this brings another error : remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/USER/REPO.git/'
FINAL EDIT : I installed git with homebrew, typed git config --global push.default simple and now it takes my credentials even without forceing the user. That's strange. Thanks everybody for your help, you're great guys !
git github ssh
git github ssh
edited Feb 7 '14 at 13:24
Yinfei
asked Feb 6 '14 at 22:27
YinfeiYinfei
6111613
6111613
2
check~/.gitconfigand$project_root/.git/configfiles. One of those two is surely misconfigured for user name.
– mu 無
Feb 6 '14 at 22:31
1
Thanks for your answer ansh0l.~/.gitconfigis clear and so is$project_root/.git/config. In fact I have this issue with every personal project, work projects can be pushed since this other user belongs to my organisation that owns those repositories.
– Yinfei
Feb 6 '14 at 22:34
Do you have multiple github accounts then? One for company, the other for personal usage?
– mu 無
Feb 6 '14 at 22:36
Nope, only one for everything.
– Yinfei
Feb 6 '14 at 22:36
1
An annoying solution would be to just regenerate another SSH key. If you are using your current SSH key with another service it would be pointless.
– Eduardo Bautista
Feb 6 '14 at 22:40
|
show 8 more comments
2
check~/.gitconfigand$project_root/.git/configfiles. One of those two is surely misconfigured for user name.
– mu 無
Feb 6 '14 at 22:31
1
Thanks for your answer ansh0l.~/.gitconfigis clear and so is$project_root/.git/config. In fact I have this issue with every personal project, work projects can be pushed since this other user belongs to my organisation that owns those repositories.
– Yinfei
Feb 6 '14 at 22:34
Do you have multiple github accounts then? One for company, the other for personal usage?
– mu 無
Feb 6 '14 at 22:36
Nope, only one for everything.
– Yinfei
Feb 6 '14 at 22:36
1
An annoying solution would be to just regenerate another SSH key. If you are using your current SSH key with another service it would be pointless.
– Eduardo Bautista
Feb 6 '14 at 22:40
2
2
check
~/.gitconfig and $project_root/.git/config files. One of those two is surely misconfigured for user name.– mu 無
Feb 6 '14 at 22:31
check
~/.gitconfig and $project_root/.git/config files. One of those two is surely misconfigured for user name.– mu 無
Feb 6 '14 at 22:31
1
1
Thanks for your answer ansh0l.
~/.gitconfig is clear and so is $project_root/.git/config. In fact I have this issue with every personal project, work projects can be pushed since this other user belongs to my organisation that owns those repositories.– Yinfei
Feb 6 '14 at 22:34
Thanks for your answer ansh0l.
~/.gitconfig is clear and so is $project_root/.git/config. In fact I have this issue with every personal project, work projects can be pushed since this other user belongs to my organisation that owns those repositories.– Yinfei
Feb 6 '14 at 22:34
Do you have multiple github accounts then? One for company, the other for personal usage?
– mu 無
Feb 6 '14 at 22:36
Do you have multiple github accounts then? One for company, the other for personal usage?
– mu 無
Feb 6 '14 at 22:36
Nope, only one for everything.
– Yinfei
Feb 6 '14 at 22:36
Nope, only one for everything.
– Yinfei
Feb 6 '14 at 22:36
1
1
An annoying solution would be to just regenerate another SSH key. If you are using your current SSH key with another service it would be pointless.
– Eduardo Bautista
Feb 6 '14 at 22:40
An annoying solution would be to just regenerate another SSH key. If you are using your current SSH key with another service it would be pointless.
– Eduardo Bautista
Feb 6 '14 at 22:40
|
show 8 more comments
13 Answers
13
active
oldest
votes
I just had this problem at work. The builtin git that ships with mac or comes when you install xcode caches git credentials in keychain. The fix for me was to:
start keychain access (start spotlight via cmd + space, type keychain, press enter)
Under keychains on the upper left, select "login"
Under category on the left, select "passwords"
find the name "github" and delete it.
2
Make sure you delete all github entry here & set the login configuration *git config --global user.name <name> *git config --global user.email <email>
– Shank_Transformer
Mar 9 '15 at 8:07
In my case, SourceTree was experiencing this problem. Deleting the item in the keychain fixed it!
– Shoerob
May 1 '15 at 19:00
1
@Shank_Transformer your solution worked for me! Thank you!
– Nazariy1995
May 3 '16 at 19:22
You may have to search for (or launch directly)seahorseon Ubuntu.
– caw
Jun 11 '17 at 23:13
3
I am in debt to you sir
– Baconbeastnz
Mar 5 '18 at 10:08
|
show 2 more comments
github identifies you by the ssh key it sees, not by any setting from git.
Therefore, you need to ensure that your work account's ssh key is not in your keyring when you try to push from your personal account and vice versa.
Use ssh-add -l to determine which keys are in your keyring, and ssh-add -d <keyfile> to remove a key from your keyring, if it dosent work remove the 'unwanted' ssh key from ~/.ssh/config.
source
NB: Github will still identify your commit based on the email only.
4
This is the only answer that explains why it was persistently using the wrong github account despite myuser.emailbeing set correctly. Wish I could upvote five times.
– Chris
Nov 28 '17 at 6:29
1
in my case removing ssh key worked like a charmssh-add -D
– rPawel
Jan 3 '18 at 16:15
This was the only answer that worked for me. Thanks!!
– Edward Hartnett
May 23 '18 at 13:54
The only option that worked. It doesn't make sense why git would not pick the right key. Since we are mentioning the ssh file it has to use in config.
– Revanth Kumar
May 24 '18 at 18:51
When I dossh-add -lI get an answer that doesn't help. It types out4096 SHA256:lotsOfGibberish,about40chars (RSA)I don't know how to us this information.
– MiguelMunoz
Nov 17 '18 at 5:42
|
show 2 more comments
Despite all the great options given by other users, the only way to fix this was to reinstall git completely and type git config --global push.default simple to rewrite good credentials.
@VonC, despite your answer was great, it didn't work at all. This is the only solution that worked for me. I wonder if it's git issue or OSX...
– swilgosz
Mar 25 '16 at 7:05
32
git config --system --unset credential.helperworked for me, I'm now asked for my GitHub credentials on push again and can supply the correct user ID and password.
– CoDEmanX
Sep 2 '16 at 12:44
@CoDEmanX your's was the only answer which worked for me. For anyone else who comes across this, it was because we use 2FA at work with github and I needed to generate a token from the github gui first and use that as my password from the command line after I had reset my local credentials ! check out https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ for details
– vancouverwill
May 9 '18 at 9:14
Its just the .gitconfig file . Either remove that or reset it... I faced this problem when I submitted a trial project for an interview. Damn it hurts though. Its with the config file
– Girish
Jul 22 '18 at 18:23
add a comment |
it looks like my terminal does the commits with my username, but pushes them with the other one
Author and committer name and email (which are important for GitHub) are derived from:
git config user.name
git config user.email
However, as mentioned in git config and git commit-tree, those values can be overridden by environment variables:
GIT_AUTHOR_NAME
GIT_AUTHOR_EMAIL
GIT_COMMITTER_NAME
GIT_COMMITTER_EMAIL
So double-check those variables.
Things work back normally if I force the user in the
.git/configof a repository but I don't think that's the good option.
But it should be a good solution.
When using an https url, I always specify the user in it to make sure the authentication is done with the right user.
http://USER@github.com/USER/REPO.git
Thanks for your reply VonC ! Unfortunately, mygit configcredentials are right and there's no environnement variables set in my/username/.bashrcfile...
– Yinfei
Feb 7 '14 at 9:36
@Yinfei84 nonetheless, check your 'env' output.
– VonC
Feb 7 '14 at 9:41
No sign of those variables there too...
– Yinfei
Feb 7 '14 at 9:47
@Yinfei84 what would happen if (to test it out) you set those variables explicitly, and try a commit and a push. Would that work better then?
– VonC
Feb 7 '14 at 10:43
2
Excuse me if I wast clear, I meant that it worked if I force the user on the path like :http://USER@github.com/USER/REPO.git
– Yinfei
Feb 7 '14 at 11:41
|
show 7 more comments
If you are using MAC, then go to Keychain Access and remove the entry of the user for which you don't want git access.
add a comment |
A temporary solution is first run killall ssh-agent then add the ssh keys generated for the account you need to use ssh-add ~/.ssh/id_4shameer
It will help us to work on multiple github account when we will get the error of type ERROR: Permission to user/repo-git.git denied to username.
I did that after having removed any Github entry from MacOS keychain, and it worked perfectly. Two points, after thekillall, the ssh-agent has to be restarted witheval "$(ssh-agent -s)", and thessh-addcommand has to be executed withsudo.
– arvymetal
Jul 25 '17 at 15:42
add a comment |
The solution for me was to add an entry in my ~/.ssh/config file for github. I had to do this because:
- I had multiple github accounts with the same key (don't do this!)
- when you 'git push' using ssh, your computer grabs id_rsa by default and uses that as its ssh identity.
- github can't (unsurprisingly) deconflict which account you mean, since it's basing the account off the key it is presented, which if tied to more than one account, leads to pain like this. The killer is, for a long time, I was getting away with this and things just worked out.
The entry I added is:
Host github.com
Hostname github.com
Port 22
User waterproofpatch
IdentityFile ~/.ssh/id_rsa_waterproofpatch
I had created a new key, unique to my account, as id_rsa_waterproofpatch. This entry in my ssh config specifies that for connections to github.com, I wish to present this key.
Another solution would probably have been for me to log into the other account, delete the duplicate ssh key.
add a comment |
I'm using Windows 10 and I faced the same issue today. In my case my credentials for different user were saved by Windows Credential manager. Thus deleting/unsetting git credentials with below command,
git config --global --unset credential.helper
didn't help. I had to manually delete the entry in Windows by following the below way,
Start --> Control Panel ---> User Accounts ---> Manager your credentials ---> Windows Credentials
Then search for an entry like, git:https://github.com and remove it. It works fine after that.
add a comment |
clearing keychain didn't help... I had to ssh-add -D and re-add the key with ssh-add <keyfile>
add a comment |
I solved this problem removing (or renaming to *.bak) the id_rsa and id_rsa.pub file on MacOS High Sierra. Idea from here.
I have custom host redirects in ~/.ssh/config that should be applied but used wrong user before I renamed the two files...
add a comment |
That's what worked for me:
- Changing the credentials inside .git-credentials
- Changing the global user.name and user.email inside .gitconfig
add a comment |
What worked for me removing the repo and adding it again:
git remote rm origin
git remote add origin git@github.com:fguillen/MyApp.git
add a comment |
I have the same problem in windows10 even after uninstall my git, as @user542833 says it is because windows cache and you should remove Github credentials in your windows Credential Manager and when you again attempting to push, windows ask your credential and set it again
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21615431%2fgit-pushes-with-wrong-user-from-terminal%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
13 Answers
13
active
oldest
votes
13 Answers
13
active
oldest
votes
active
oldest
votes
active
oldest
votes
I just had this problem at work. The builtin git that ships with mac or comes when you install xcode caches git credentials in keychain. The fix for me was to:
start keychain access (start spotlight via cmd + space, type keychain, press enter)
Under keychains on the upper left, select "login"
Under category on the left, select "passwords"
find the name "github" and delete it.
2
Make sure you delete all github entry here & set the login configuration *git config --global user.name <name> *git config --global user.email <email>
– Shank_Transformer
Mar 9 '15 at 8:07
In my case, SourceTree was experiencing this problem. Deleting the item in the keychain fixed it!
– Shoerob
May 1 '15 at 19:00
1
@Shank_Transformer your solution worked for me! Thank you!
– Nazariy1995
May 3 '16 at 19:22
You may have to search for (or launch directly)seahorseon Ubuntu.
– caw
Jun 11 '17 at 23:13
3
I am in debt to you sir
– Baconbeastnz
Mar 5 '18 at 10:08
|
show 2 more comments
I just had this problem at work. The builtin git that ships with mac or comes when you install xcode caches git credentials in keychain. The fix for me was to:
start keychain access (start spotlight via cmd + space, type keychain, press enter)
Under keychains on the upper left, select "login"
Under category on the left, select "passwords"
find the name "github" and delete it.
2
Make sure you delete all github entry here & set the login configuration *git config --global user.name <name> *git config --global user.email <email>
– Shank_Transformer
Mar 9 '15 at 8:07
In my case, SourceTree was experiencing this problem. Deleting the item in the keychain fixed it!
– Shoerob
May 1 '15 at 19:00
1
@Shank_Transformer your solution worked for me! Thank you!
– Nazariy1995
May 3 '16 at 19:22
You may have to search for (or launch directly)seahorseon Ubuntu.
– caw
Jun 11 '17 at 23:13
3
I am in debt to you sir
– Baconbeastnz
Mar 5 '18 at 10:08
|
show 2 more comments
I just had this problem at work. The builtin git that ships with mac or comes when you install xcode caches git credentials in keychain. The fix for me was to:
start keychain access (start spotlight via cmd + space, type keychain, press enter)
Under keychains on the upper left, select "login"
Under category on the left, select "passwords"
find the name "github" and delete it.
I just had this problem at work. The builtin git that ships with mac or comes when you install xcode caches git credentials in keychain. The fix for me was to:
start keychain access (start spotlight via cmd + space, type keychain, press enter)
Under keychains on the upper left, select "login"
Under category on the left, select "passwords"
find the name "github" and delete it.
answered Jun 10 '14 at 0:10
user542833user542833
7,4403126
7,4403126
2
Make sure you delete all github entry here & set the login configuration *git config --global user.name <name> *git config --global user.email <email>
– Shank_Transformer
Mar 9 '15 at 8:07
In my case, SourceTree was experiencing this problem. Deleting the item in the keychain fixed it!
– Shoerob
May 1 '15 at 19:00
1
@Shank_Transformer your solution worked for me! Thank you!
– Nazariy1995
May 3 '16 at 19:22
You may have to search for (or launch directly)seahorseon Ubuntu.
– caw
Jun 11 '17 at 23:13
3
I am in debt to you sir
– Baconbeastnz
Mar 5 '18 at 10:08
|
show 2 more comments
2
Make sure you delete all github entry here & set the login configuration *git config --global user.name <name> *git config --global user.email <email>
– Shank_Transformer
Mar 9 '15 at 8:07
In my case, SourceTree was experiencing this problem. Deleting the item in the keychain fixed it!
– Shoerob
May 1 '15 at 19:00
1
@Shank_Transformer your solution worked for me! Thank you!
– Nazariy1995
May 3 '16 at 19:22
You may have to search for (or launch directly)seahorseon Ubuntu.
– caw
Jun 11 '17 at 23:13
3
I am in debt to you sir
– Baconbeastnz
Mar 5 '18 at 10:08
2
2
Make sure you delete all github entry here & set the login configuration *git config --global user.name <name> *git config --global user.email <email>
– Shank_Transformer
Mar 9 '15 at 8:07
Make sure you delete all github entry here & set the login configuration *git config --global user.name <name> *git config --global user.email <email>
– Shank_Transformer
Mar 9 '15 at 8:07
In my case, SourceTree was experiencing this problem. Deleting the item in the keychain fixed it!
– Shoerob
May 1 '15 at 19:00
In my case, SourceTree was experiencing this problem. Deleting the item in the keychain fixed it!
– Shoerob
May 1 '15 at 19:00
1
1
@Shank_Transformer your solution worked for me! Thank you!
– Nazariy1995
May 3 '16 at 19:22
@Shank_Transformer your solution worked for me! Thank you!
– Nazariy1995
May 3 '16 at 19:22
You may have to search for (or launch directly)
seahorse on Ubuntu.– caw
Jun 11 '17 at 23:13
You may have to search for (or launch directly)
seahorse on Ubuntu.– caw
Jun 11 '17 at 23:13
3
3
I am in debt to you sir
– Baconbeastnz
Mar 5 '18 at 10:08
I am in debt to you sir
– Baconbeastnz
Mar 5 '18 at 10:08
|
show 2 more comments
github identifies you by the ssh key it sees, not by any setting from git.
Therefore, you need to ensure that your work account's ssh key is not in your keyring when you try to push from your personal account and vice versa.
Use ssh-add -l to determine which keys are in your keyring, and ssh-add -d <keyfile> to remove a key from your keyring, if it dosent work remove the 'unwanted' ssh key from ~/.ssh/config.
source
NB: Github will still identify your commit based on the email only.
4
This is the only answer that explains why it was persistently using the wrong github account despite myuser.emailbeing set correctly. Wish I could upvote five times.
– Chris
Nov 28 '17 at 6:29
1
in my case removing ssh key worked like a charmssh-add -D
– rPawel
Jan 3 '18 at 16:15
This was the only answer that worked for me. Thanks!!
– Edward Hartnett
May 23 '18 at 13:54
The only option that worked. It doesn't make sense why git would not pick the right key. Since we are mentioning the ssh file it has to use in config.
– Revanth Kumar
May 24 '18 at 18:51
When I dossh-add -lI get an answer that doesn't help. It types out4096 SHA256:lotsOfGibberish,about40chars (RSA)I don't know how to us this information.
– MiguelMunoz
Nov 17 '18 at 5:42
|
show 2 more comments
github identifies you by the ssh key it sees, not by any setting from git.
Therefore, you need to ensure that your work account's ssh key is not in your keyring when you try to push from your personal account and vice versa.
Use ssh-add -l to determine which keys are in your keyring, and ssh-add -d <keyfile> to remove a key from your keyring, if it dosent work remove the 'unwanted' ssh key from ~/.ssh/config.
source
NB: Github will still identify your commit based on the email only.
4
This is the only answer that explains why it was persistently using the wrong github account despite myuser.emailbeing set correctly. Wish I could upvote five times.
– Chris
Nov 28 '17 at 6:29
1
in my case removing ssh key worked like a charmssh-add -D
– rPawel
Jan 3 '18 at 16:15
This was the only answer that worked for me. Thanks!!
– Edward Hartnett
May 23 '18 at 13:54
The only option that worked. It doesn't make sense why git would not pick the right key. Since we are mentioning the ssh file it has to use in config.
– Revanth Kumar
May 24 '18 at 18:51
When I dossh-add -lI get an answer that doesn't help. It types out4096 SHA256:lotsOfGibberish,about40chars (RSA)I don't know how to us this information.
– MiguelMunoz
Nov 17 '18 at 5:42
|
show 2 more comments
github identifies you by the ssh key it sees, not by any setting from git.
Therefore, you need to ensure that your work account's ssh key is not in your keyring when you try to push from your personal account and vice versa.
Use ssh-add -l to determine which keys are in your keyring, and ssh-add -d <keyfile> to remove a key from your keyring, if it dosent work remove the 'unwanted' ssh key from ~/.ssh/config.
source
NB: Github will still identify your commit based on the email only.
github identifies you by the ssh key it sees, not by any setting from git.
Therefore, you need to ensure that your work account's ssh key is not in your keyring when you try to push from your personal account and vice versa.
Use ssh-add -l to determine which keys are in your keyring, and ssh-add -d <keyfile> to remove a key from your keyring, if it dosent work remove the 'unwanted' ssh key from ~/.ssh/config.
source
NB: Github will still identify your commit based on the email only.
edited Mar 23 at 8:23
answered Sep 11 '16 at 22:34
nithinnithin
1,517821
1,517821
4
This is the only answer that explains why it was persistently using the wrong github account despite myuser.emailbeing set correctly. Wish I could upvote five times.
– Chris
Nov 28 '17 at 6:29
1
in my case removing ssh key worked like a charmssh-add -D
– rPawel
Jan 3 '18 at 16:15
This was the only answer that worked for me. Thanks!!
– Edward Hartnett
May 23 '18 at 13:54
The only option that worked. It doesn't make sense why git would not pick the right key. Since we are mentioning the ssh file it has to use in config.
– Revanth Kumar
May 24 '18 at 18:51
When I dossh-add -lI get an answer that doesn't help. It types out4096 SHA256:lotsOfGibberish,about40chars (RSA)I don't know how to us this information.
– MiguelMunoz
Nov 17 '18 at 5:42
|
show 2 more comments
4
This is the only answer that explains why it was persistently using the wrong github account despite myuser.emailbeing set correctly. Wish I could upvote five times.
– Chris
Nov 28 '17 at 6:29
1
in my case removing ssh key worked like a charmssh-add -D
– rPawel
Jan 3 '18 at 16:15
This was the only answer that worked for me. Thanks!!
– Edward Hartnett
May 23 '18 at 13:54
The only option that worked. It doesn't make sense why git would not pick the right key. Since we are mentioning the ssh file it has to use in config.
– Revanth Kumar
May 24 '18 at 18:51
When I dossh-add -lI get an answer that doesn't help. It types out4096 SHA256:lotsOfGibberish,about40chars (RSA)I don't know how to us this information.
– MiguelMunoz
Nov 17 '18 at 5:42
4
4
This is the only answer that explains why it was persistently using the wrong github account despite my
user.email being set correctly. Wish I could upvote five times.– Chris
Nov 28 '17 at 6:29
This is the only answer that explains why it was persistently using the wrong github account despite my
user.email being set correctly. Wish I could upvote five times.– Chris
Nov 28 '17 at 6:29
1
1
in my case removing ssh key worked like a charm
ssh-add -D– rPawel
Jan 3 '18 at 16:15
in my case removing ssh key worked like a charm
ssh-add -D– rPawel
Jan 3 '18 at 16:15
This was the only answer that worked for me. Thanks!!
– Edward Hartnett
May 23 '18 at 13:54
This was the only answer that worked for me. Thanks!!
– Edward Hartnett
May 23 '18 at 13:54
The only option that worked. It doesn't make sense why git would not pick the right key. Since we are mentioning the ssh file it has to use in config.
– Revanth Kumar
May 24 '18 at 18:51
The only option that worked. It doesn't make sense why git would not pick the right key. Since we are mentioning the ssh file it has to use in config.
– Revanth Kumar
May 24 '18 at 18:51
When I do
ssh-add -l I get an answer that doesn't help. It types out 4096 SHA256:lotsOfGibberish,about40chars (RSA) I don't know how to us this information.– MiguelMunoz
Nov 17 '18 at 5:42
When I do
ssh-add -l I get an answer that doesn't help. It types out 4096 SHA256:lotsOfGibberish,about40chars (RSA) I don't know how to us this information.– MiguelMunoz
Nov 17 '18 at 5:42
|
show 2 more comments
Despite all the great options given by other users, the only way to fix this was to reinstall git completely and type git config --global push.default simple to rewrite good credentials.
@VonC, despite your answer was great, it didn't work at all. This is the only solution that worked for me. I wonder if it's git issue or OSX...
– swilgosz
Mar 25 '16 at 7:05
32
git config --system --unset credential.helperworked for me, I'm now asked for my GitHub credentials on push again and can supply the correct user ID and password.
– CoDEmanX
Sep 2 '16 at 12:44
@CoDEmanX your's was the only answer which worked for me. For anyone else who comes across this, it was because we use 2FA at work with github and I needed to generate a token from the github gui first and use that as my password from the command line after I had reset my local credentials ! check out https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ for details
– vancouverwill
May 9 '18 at 9:14
Its just the .gitconfig file . Either remove that or reset it... I faced this problem when I submitted a trial project for an interview. Damn it hurts though. Its with the config file
– Girish
Jul 22 '18 at 18:23
add a comment |
Despite all the great options given by other users, the only way to fix this was to reinstall git completely and type git config --global push.default simple to rewrite good credentials.
@VonC, despite your answer was great, it didn't work at all. This is the only solution that worked for me. I wonder if it's git issue or OSX...
– swilgosz
Mar 25 '16 at 7:05
32
git config --system --unset credential.helperworked for me, I'm now asked for my GitHub credentials on push again and can supply the correct user ID and password.
– CoDEmanX
Sep 2 '16 at 12:44
@CoDEmanX your's was the only answer which worked for me. For anyone else who comes across this, it was because we use 2FA at work with github and I needed to generate a token from the github gui first and use that as my password from the command line after I had reset my local credentials ! check out https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ for details
– vancouverwill
May 9 '18 at 9:14
Its just the .gitconfig file . Either remove that or reset it... I faced this problem when I submitted a trial project for an interview. Damn it hurts though. Its with the config file
– Girish
Jul 22 '18 at 18:23
add a comment |
Despite all the great options given by other users, the only way to fix this was to reinstall git completely and type git config --global push.default simple to rewrite good credentials.
Despite all the great options given by other users, the only way to fix this was to reinstall git completely and type git config --global push.default simple to rewrite good credentials.
answered Mar 12 '14 at 8:35
YinfeiYinfei
6111613
6111613
@VonC, despite your answer was great, it didn't work at all. This is the only solution that worked for me. I wonder if it's git issue or OSX...
– swilgosz
Mar 25 '16 at 7:05
32
git config --system --unset credential.helperworked for me, I'm now asked for my GitHub credentials on push again and can supply the correct user ID and password.
– CoDEmanX
Sep 2 '16 at 12:44
@CoDEmanX your's was the only answer which worked for me. For anyone else who comes across this, it was because we use 2FA at work with github and I needed to generate a token from the github gui first and use that as my password from the command line after I had reset my local credentials ! check out https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ for details
– vancouverwill
May 9 '18 at 9:14
Its just the .gitconfig file . Either remove that or reset it... I faced this problem when I submitted a trial project for an interview. Damn it hurts though. Its with the config file
– Girish
Jul 22 '18 at 18:23
add a comment |
@VonC, despite your answer was great, it didn't work at all. This is the only solution that worked for me. I wonder if it's git issue or OSX...
– swilgosz
Mar 25 '16 at 7:05
32
git config --system --unset credential.helperworked for me, I'm now asked for my GitHub credentials on push again and can supply the correct user ID and password.
– CoDEmanX
Sep 2 '16 at 12:44
@CoDEmanX your's was the only answer which worked for me. For anyone else who comes across this, it was because we use 2FA at work with github and I needed to generate a token from the github gui first and use that as my password from the command line after I had reset my local credentials ! check out https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ for details
– vancouverwill
May 9 '18 at 9:14
Its just the .gitconfig file . Either remove that or reset it... I faced this problem when I submitted a trial project for an interview. Damn it hurts though. Its with the config file
– Girish
Jul 22 '18 at 18:23
@VonC, despite your answer was great, it didn't work at all. This is the only solution that worked for me. I wonder if it's git issue or OSX...
– swilgosz
Mar 25 '16 at 7:05
@VonC, despite your answer was great, it didn't work at all. This is the only solution that worked for me. I wonder if it's git issue or OSX...
– swilgosz
Mar 25 '16 at 7:05
32
32
git config --system --unset credential.helper worked for me, I'm now asked for my GitHub credentials on push again and can supply the correct user ID and password.– CoDEmanX
Sep 2 '16 at 12:44
git config --system --unset credential.helper worked for me, I'm now asked for my GitHub credentials on push again and can supply the correct user ID and password.– CoDEmanX
Sep 2 '16 at 12:44
@CoDEmanX your's was the only answer which worked for me. For anyone else who comes across this, it was because we use 2FA at work with github and I needed to generate a token from the github gui first and use that as my password from the command line after I had reset my local credentials ! check out https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ for details
– vancouverwill
May 9 '18 at 9:14
@CoDEmanX your's was the only answer which worked for me. For anyone else who comes across this, it was because we use 2FA at work with github and I needed to generate a token from the github gui first and use that as my password from the command line after I had reset my local credentials ! check out https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ for details
– vancouverwill
May 9 '18 at 9:14
Its just the .gitconfig file . Either remove that or reset it... I faced this problem when I submitted a trial project for an interview. Damn it hurts though. Its with the config file
– Girish
Jul 22 '18 at 18:23
Its just the .gitconfig file . Either remove that or reset it... I faced this problem when I submitted a trial project for an interview. Damn it hurts though. Its with the config file
– Girish
Jul 22 '18 at 18:23
add a comment |
it looks like my terminal does the commits with my username, but pushes them with the other one
Author and committer name and email (which are important for GitHub) are derived from:
git config user.name
git config user.email
However, as mentioned in git config and git commit-tree, those values can be overridden by environment variables:
GIT_AUTHOR_NAME
GIT_AUTHOR_EMAIL
GIT_COMMITTER_NAME
GIT_COMMITTER_EMAIL
So double-check those variables.
Things work back normally if I force the user in the
.git/configof a repository but I don't think that's the good option.
But it should be a good solution.
When using an https url, I always specify the user in it to make sure the authentication is done with the right user.
http://USER@github.com/USER/REPO.git
Thanks for your reply VonC ! Unfortunately, mygit configcredentials are right and there's no environnement variables set in my/username/.bashrcfile...
– Yinfei
Feb 7 '14 at 9:36
@Yinfei84 nonetheless, check your 'env' output.
– VonC
Feb 7 '14 at 9:41
No sign of those variables there too...
– Yinfei
Feb 7 '14 at 9:47
@Yinfei84 what would happen if (to test it out) you set those variables explicitly, and try a commit and a push. Would that work better then?
– VonC
Feb 7 '14 at 10:43
2
Excuse me if I wast clear, I meant that it worked if I force the user on the path like :http://USER@github.com/USER/REPO.git
– Yinfei
Feb 7 '14 at 11:41
|
show 7 more comments
it looks like my terminal does the commits with my username, but pushes them with the other one
Author and committer name and email (which are important for GitHub) are derived from:
git config user.name
git config user.email
However, as mentioned in git config and git commit-tree, those values can be overridden by environment variables:
GIT_AUTHOR_NAME
GIT_AUTHOR_EMAIL
GIT_COMMITTER_NAME
GIT_COMMITTER_EMAIL
So double-check those variables.
Things work back normally if I force the user in the
.git/configof a repository but I don't think that's the good option.
But it should be a good solution.
When using an https url, I always specify the user in it to make sure the authentication is done with the right user.
http://USER@github.com/USER/REPO.git
Thanks for your reply VonC ! Unfortunately, mygit configcredentials are right and there's no environnement variables set in my/username/.bashrcfile...
– Yinfei
Feb 7 '14 at 9:36
@Yinfei84 nonetheless, check your 'env' output.
– VonC
Feb 7 '14 at 9:41
No sign of those variables there too...
– Yinfei
Feb 7 '14 at 9:47
@Yinfei84 what would happen if (to test it out) you set those variables explicitly, and try a commit and a push. Would that work better then?
– VonC
Feb 7 '14 at 10:43
2
Excuse me if I wast clear, I meant that it worked if I force the user on the path like :http://USER@github.com/USER/REPO.git
– Yinfei
Feb 7 '14 at 11:41
|
show 7 more comments
it looks like my terminal does the commits with my username, but pushes them with the other one
Author and committer name and email (which are important for GitHub) are derived from:
git config user.name
git config user.email
However, as mentioned in git config and git commit-tree, those values can be overridden by environment variables:
GIT_AUTHOR_NAME
GIT_AUTHOR_EMAIL
GIT_COMMITTER_NAME
GIT_COMMITTER_EMAIL
So double-check those variables.
Things work back normally if I force the user in the
.git/configof a repository but I don't think that's the good option.
But it should be a good solution.
When using an https url, I always specify the user in it to make sure the authentication is done with the right user.
http://USER@github.com/USER/REPO.git
it looks like my terminal does the commits with my username, but pushes them with the other one
Author and committer name and email (which are important for GitHub) are derived from:
git config user.name
git config user.email
However, as mentioned in git config and git commit-tree, those values can be overridden by environment variables:
GIT_AUTHOR_NAME
GIT_AUTHOR_EMAIL
GIT_COMMITTER_NAME
GIT_COMMITTER_EMAIL
So double-check those variables.
Things work back normally if I force the user in the
.git/configof a repository but I don't think that's the good option.
But it should be a good solution.
When using an https url, I always specify the user in it to make sure the authentication is done with the right user.
http://USER@github.com/USER/REPO.git
edited Feb 7 '14 at 11:44
answered Feb 7 '14 at 7:35
VonCVonC
860k30927543321
860k30927543321
Thanks for your reply VonC ! Unfortunately, mygit configcredentials are right and there's no environnement variables set in my/username/.bashrcfile...
– Yinfei
Feb 7 '14 at 9:36
@Yinfei84 nonetheless, check your 'env' output.
– VonC
Feb 7 '14 at 9:41
No sign of those variables there too...
– Yinfei
Feb 7 '14 at 9:47
@Yinfei84 what would happen if (to test it out) you set those variables explicitly, and try a commit and a push. Would that work better then?
– VonC
Feb 7 '14 at 10:43
2
Excuse me if I wast clear, I meant that it worked if I force the user on the path like :http://USER@github.com/USER/REPO.git
– Yinfei
Feb 7 '14 at 11:41
|
show 7 more comments
Thanks for your reply VonC ! Unfortunately, mygit configcredentials are right and there's no environnement variables set in my/username/.bashrcfile...
– Yinfei
Feb 7 '14 at 9:36
@Yinfei84 nonetheless, check your 'env' output.
– VonC
Feb 7 '14 at 9:41
No sign of those variables there too...
– Yinfei
Feb 7 '14 at 9:47
@Yinfei84 what would happen if (to test it out) you set those variables explicitly, and try a commit and a push. Would that work better then?
– VonC
Feb 7 '14 at 10:43
2
Excuse me if I wast clear, I meant that it worked if I force the user on the path like :http://USER@github.com/USER/REPO.git
– Yinfei
Feb 7 '14 at 11:41
Thanks for your reply VonC ! Unfortunately, my
git configcredentials are right and there's no environnement variables set in my /username/.bashrc file...– Yinfei
Feb 7 '14 at 9:36
Thanks for your reply VonC ! Unfortunately, my
git configcredentials are right and there's no environnement variables set in my /username/.bashrc file...– Yinfei
Feb 7 '14 at 9:36
@Yinfei84 nonetheless, check your '
env' output.– VonC
Feb 7 '14 at 9:41
@Yinfei84 nonetheless, check your '
env' output.– VonC
Feb 7 '14 at 9:41
No sign of those variables there too...
– Yinfei
Feb 7 '14 at 9:47
No sign of those variables there too...
– Yinfei
Feb 7 '14 at 9:47
@Yinfei84 what would happen if (to test it out) you set those variables explicitly, and try a commit and a push. Would that work better then?
– VonC
Feb 7 '14 at 10:43
@Yinfei84 what would happen if (to test it out) you set those variables explicitly, and try a commit and a push. Would that work better then?
– VonC
Feb 7 '14 at 10:43
2
2
Excuse me if I wast clear, I meant that it worked if I force the user on the path like :
http://USER@github.com/USER/REPO.git– Yinfei
Feb 7 '14 at 11:41
Excuse me if I wast clear, I meant that it worked if I force the user on the path like :
http://USER@github.com/USER/REPO.git– Yinfei
Feb 7 '14 at 11:41
|
show 7 more comments
If you are using MAC, then go to Keychain Access and remove the entry of the user for which you don't want git access.
add a comment |
If you are using MAC, then go to Keychain Access and remove the entry of the user for which you don't want git access.
add a comment |
If you are using MAC, then go to Keychain Access and remove the entry of the user for which you don't want git access.
If you are using MAC, then go to Keychain Access and remove the entry of the user for which you don't want git access.
answered May 15 '16 at 4:04
Chitrapal SinghChitrapal Singh
6911
6911
add a comment |
add a comment |
A temporary solution is first run killall ssh-agent then add the ssh keys generated for the account you need to use ssh-add ~/.ssh/id_4shameer
It will help us to work on multiple github account when we will get the error of type ERROR: Permission to user/repo-git.git denied to username.
I did that after having removed any Github entry from MacOS keychain, and it worked perfectly. Two points, after thekillall, the ssh-agent has to be restarted witheval "$(ssh-agent -s)", and thessh-addcommand has to be executed withsudo.
– arvymetal
Jul 25 '17 at 15:42
add a comment |
A temporary solution is first run killall ssh-agent then add the ssh keys generated for the account you need to use ssh-add ~/.ssh/id_4shameer
It will help us to work on multiple github account when we will get the error of type ERROR: Permission to user/repo-git.git denied to username.
I did that after having removed any Github entry from MacOS keychain, and it worked perfectly. Two points, after thekillall, the ssh-agent has to be restarted witheval "$(ssh-agent -s)", and thessh-addcommand has to be executed withsudo.
– arvymetal
Jul 25 '17 at 15:42
add a comment |
A temporary solution is first run killall ssh-agent then add the ssh keys generated for the account you need to use ssh-add ~/.ssh/id_4shameer
It will help us to work on multiple github account when we will get the error of type ERROR: Permission to user/repo-git.git denied to username.
A temporary solution is first run killall ssh-agent then add the ssh keys generated for the account you need to use ssh-add ~/.ssh/id_4shameer
It will help us to work on multiple github account when we will get the error of type ERROR: Permission to user/repo-git.git denied to username.
answered Nov 2 '16 at 8:44
mshameermshameer
396412
396412
I did that after having removed any Github entry from MacOS keychain, and it worked perfectly. Two points, after thekillall, the ssh-agent has to be restarted witheval "$(ssh-agent -s)", and thessh-addcommand has to be executed withsudo.
– arvymetal
Jul 25 '17 at 15:42
add a comment |
I did that after having removed any Github entry from MacOS keychain, and it worked perfectly. Two points, after thekillall, the ssh-agent has to be restarted witheval "$(ssh-agent -s)", and thessh-addcommand has to be executed withsudo.
– arvymetal
Jul 25 '17 at 15:42
I did that after having removed any Github entry from MacOS keychain, and it worked perfectly. Two points, after the
killall, the ssh-agent has to be restarted with eval "$(ssh-agent -s)", and the ssh-addcommand has to be executed with sudo.– arvymetal
Jul 25 '17 at 15:42
I did that after having removed any Github entry from MacOS keychain, and it worked perfectly. Two points, after the
killall, the ssh-agent has to be restarted with eval "$(ssh-agent -s)", and the ssh-addcommand has to be executed with sudo.– arvymetal
Jul 25 '17 at 15:42
add a comment |
The solution for me was to add an entry in my ~/.ssh/config file for github. I had to do this because:
- I had multiple github accounts with the same key (don't do this!)
- when you 'git push' using ssh, your computer grabs id_rsa by default and uses that as its ssh identity.
- github can't (unsurprisingly) deconflict which account you mean, since it's basing the account off the key it is presented, which if tied to more than one account, leads to pain like this. The killer is, for a long time, I was getting away with this and things just worked out.
The entry I added is:
Host github.com
Hostname github.com
Port 22
User waterproofpatch
IdentityFile ~/.ssh/id_rsa_waterproofpatch
I had created a new key, unique to my account, as id_rsa_waterproofpatch. This entry in my ssh config specifies that for connections to github.com, I wish to present this key.
Another solution would probably have been for me to log into the other account, delete the duplicate ssh key.
add a comment |
The solution for me was to add an entry in my ~/.ssh/config file for github. I had to do this because:
- I had multiple github accounts with the same key (don't do this!)
- when you 'git push' using ssh, your computer grabs id_rsa by default and uses that as its ssh identity.
- github can't (unsurprisingly) deconflict which account you mean, since it's basing the account off the key it is presented, which if tied to more than one account, leads to pain like this. The killer is, for a long time, I was getting away with this and things just worked out.
The entry I added is:
Host github.com
Hostname github.com
Port 22
User waterproofpatch
IdentityFile ~/.ssh/id_rsa_waterproofpatch
I had created a new key, unique to my account, as id_rsa_waterproofpatch. This entry in my ssh config specifies that for connections to github.com, I wish to present this key.
Another solution would probably have been for me to log into the other account, delete the duplicate ssh key.
add a comment |
The solution for me was to add an entry in my ~/.ssh/config file for github. I had to do this because:
- I had multiple github accounts with the same key (don't do this!)
- when you 'git push' using ssh, your computer grabs id_rsa by default and uses that as its ssh identity.
- github can't (unsurprisingly) deconflict which account you mean, since it's basing the account off the key it is presented, which if tied to more than one account, leads to pain like this. The killer is, for a long time, I was getting away with this and things just worked out.
The entry I added is:
Host github.com
Hostname github.com
Port 22
User waterproofpatch
IdentityFile ~/.ssh/id_rsa_waterproofpatch
I had created a new key, unique to my account, as id_rsa_waterproofpatch. This entry in my ssh config specifies that for connections to github.com, I wish to present this key.
Another solution would probably have been for me to log into the other account, delete the duplicate ssh key.
The solution for me was to add an entry in my ~/.ssh/config file for github. I had to do this because:
- I had multiple github accounts with the same key (don't do this!)
- when you 'git push' using ssh, your computer grabs id_rsa by default and uses that as its ssh identity.
- github can't (unsurprisingly) deconflict which account you mean, since it's basing the account off the key it is presented, which if tied to more than one account, leads to pain like this. The killer is, for a long time, I was getting away with this and things just worked out.
The entry I added is:
Host github.com
Hostname github.com
Port 22
User waterproofpatch
IdentityFile ~/.ssh/id_rsa_waterproofpatch
I had created a new key, unique to my account, as id_rsa_waterproofpatch. This entry in my ssh config specifies that for connections to github.com, I wish to present this key.
Another solution would probably have been for me to log into the other account, delete the duplicate ssh key.
edited May 3 '18 at 3:48
answered May 2 '18 at 4:22
waterproofpatchwaterproofpatch
614
614
add a comment |
add a comment |
I'm using Windows 10 and I faced the same issue today. In my case my credentials for different user were saved by Windows Credential manager. Thus deleting/unsetting git credentials with below command,
git config --global --unset credential.helper
didn't help. I had to manually delete the entry in Windows by following the below way,
Start --> Control Panel ---> User Accounts ---> Manager your credentials ---> Windows Credentials
Then search for an entry like, git:https://github.com and remove it. It works fine after that.
add a comment |
I'm using Windows 10 and I faced the same issue today. In my case my credentials for different user were saved by Windows Credential manager. Thus deleting/unsetting git credentials with below command,
git config --global --unset credential.helper
didn't help. I had to manually delete the entry in Windows by following the below way,
Start --> Control Panel ---> User Accounts ---> Manager your credentials ---> Windows Credentials
Then search for an entry like, git:https://github.com and remove it. It works fine after that.
add a comment |
I'm using Windows 10 and I faced the same issue today. In my case my credentials for different user were saved by Windows Credential manager. Thus deleting/unsetting git credentials with below command,
git config --global --unset credential.helper
didn't help. I had to manually delete the entry in Windows by following the below way,
Start --> Control Panel ---> User Accounts ---> Manager your credentials ---> Windows Credentials
Then search for an entry like, git:https://github.com and remove it. It works fine after that.
I'm using Windows 10 and I faced the same issue today. In my case my credentials for different user were saved by Windows Credential manager. Thus deleting/unsetting git credentials with below command,
git config --global --unset credential.helper
didn't help. I had to manually delete the entry in Windows by following the below way,
Start --> Control Panel ---> User Accounts ---> Manager your credentials ---> Windows Credentials
Then search for an entry like, git:https://github.com and remove it. It works fine after that.
answered Mar 2 at 13:21
GowthamGowtham
365
365
add a comment |
add a comment |
clearing keychain didn't help... I had to ssh-add -D and re-add the key with ssh-add <keyfile>
add a comment |
clearing keychain didn't help... I had to ssh-add -D and re-add the key with ssh-add <keyfile>
add a comment |
clearing keychain didn't help... I had to ssh-add -D and re-add the key with ssh-add <keyfile>
clearing keychain didn't help... I had to ssh-add -D and re-add the key with ssh-add <keyfile>
answered May 3 '18 at 15:39
Victor PiousboxVictor Piousbox
2,20732754
2,20732754
add a comment |
add a comment |
I solved this problem removing (or renaming to *.bak) the id_rsa and id_rsa.pub file on MacOS High Sierra. Idea from here.
I have custom host redirects in ~/.ssh/config that should be applied but used wrong user before I renamed the two files...
add a comment |
I solved this problem removing (or renaming to *.bak) the id_rsa and id_rsa.pub file on MacOS High Sierra. Idea from here.
I have custom host redirects in ~/.ssh/config that should be applied but used wrong user before I renamed the two files...
add a comment |
I solved this problem removing (or renaming to *.bak) the id_rsa and id_rsa.pub file on MacOS High Sierra. Idea from here.
I have custom host redirects in ~/.ssh/config that should be applied but used wrong user before I renamed the two files...
I solved this problem removing (or renaming to *.bak) the id_rsa and id_rsa.pub file on MacOS High Sierra. Idea from here.
I have custom host redirects in ~/.ssh/config that should be applied but used wrong user before I renamed the two files...
answered Jul 18 '18 at 12:19
CodingYourLifeCodingYourLife
1,39631733
1,39631733
add a comment |
add a comment |
That's what worked for me:
- Changing the credentials inside .git-credentials
- Changing the global user.name and user.email inside .gitconfig
add a comment |
That's what worked for me:
- Changing the credentials inside .git-credentials
- Changing the global user.name and user.email inside .gitconfig
add a comment |
That's what worked for me:
- Changing the credentials inside .git-credentials
- Changing the global user.name and user.email inside .gitconfig
That's what worked for me:
- Changing the credentials inside .git-credentials
- Changing the global user.name and user.email inside .gitconfig
edited Sep 11 '18 at 9:03
answered Sep 10 '18 at 15:32
reshetechreshetech
629510
629510
add a comment |
add a comment |
What worked for me removing the repo and adding it again:
git remote rm origin
git remote add origin git@github.com:fguillen/MyApp.git
add a comment |
What worked for me removing the repo and adding it again:
git remote rm origin
git remote add origin git@github.com:fguillen/MyApp.git
add a comment |
What worked for me removing the repo and adding it again:
git remote rm origin
git remote add origin git@github.com:fguillen/MyApp.git
What worked for me removing the repo and adding it again:
git remote rm origin
git remote add origin git@github.com:fguillen/MyApp.git
answered Jan 26 at 14:36
fguillenfguillen
22.4k1388149
22.4k1388149
add a comment |
add a comment |
I have the same problem in windows10 even after uninstall my git, as @user542833 says it is because windows cache and you should remove Github credentials in your windows Credential Manager and when you again attempting to push, windows ask your credential and set it again
add a comment |
I have the same problem in windows10 even after uninstall my git, as @user542833 says it is because windows cache and you should remove Github credentials in your windows Credential Manager and when you again attempting to push, windows ask your credential and set it again
add a comment |
I have the same problem in windows10 even after uninstall my git, as @user542833 says it is because windows cache and you should remove Github credentials in your windows Credential Manager and when you again attempting to push, windows ask your credential and set it again
I have the same problem in windows10 even after uninstall my git, as @user542833 says it is because windows cache and you should remove Github credentials in your windows Credential Manager and when you again attempting to push, windows ask your credential and set it again
answered Mar 5 at 13:04
ghazaleh javaherighazaleh javaheri
342211
342211
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21615431%2fgit-pushes-with-wrong-user-from-terminal%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
check
~/.gitconfigand$project_root/.git/configfiles. One of those two is surely misconfigured for user name.– mu 無
Feb 6 '14 at 22:31
1
Thanks for your answer ansh0l.
~/.gitconfigis clear and so is$project_root/.git/config. In fact I have this issue with every personal project, work projects can be pushed since this other user belongs to my organisation that owns those repositories.– Yinfei
Feb 6 '14 at 22:34
Do you have multiple github accounts then? One for company, the other for personal usage?
– mu 無
Feb 6 '14 at 22:36
Nope, only one for everything.
– Yinfei
Feb 6 '14 at 22:36
1
An annoying solution would be to just regenerate another SSH key. If you are using your current SSH key with another service it would be pointless.
– Eduardo Bautista
Feb 6 '14 at 22:40