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
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.
What a pain in the butt!
problem:
turns for unknow reason git push was using the wrong user. I have a couple of different git hub user ids. I work for 2 different companies and also have a student id
I am working on a mac. here is what I finally did
1) remove the credential.helper
a. you need to figure out where the credential.helper is configured
git config --local credential.helper
git config --global credential.helper
git config --system credential.helper
b. once find the correct fig file remove it as follows
git config --global --unset credential.helper
Now in my local repo I hacked the .git/config file
I changed
url = https://github.com/aedavids/lab3RotationProject.git
to
url = https://myGitHubUserId@github.com/aedavids/lab3RotationProject.git
That's what worked for me:
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.
First Go to this path in Windows
Start --> Control Panel --> User Accounts --> Manager your credentials --> Windows Credentials
And Remove the credential from git:https://github.com
Then add your GitHub account username and password from which you want to push the code at the same place.
To check whether git will push from the username that you added now enter the following command in git bash.
git config user.name
This will show you the username from which the git will push. If the username is correct then your problem is solved.
For me this didn't solve the problem it was still showing my previous account username that I removed.
Now enter the username and email Id of the account from which you want to push in the following command in git bash.
git config --global user.name your_username
git config --global user.email your_emaiid
This will now change the user.
Before pushing any code you can verify whether the user is changed or not by again using the following command.
git config user.name
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.