2

When I change files and write:

git add .
git commit -m "test"
git push

then git automaticaly pushes it to my github account without asking about username and password. I have tried:

git config --global --remove-section user
git config --global --unset-all user.name
git config --global --unset-all user.email
git config --global --unset-all user.password

but didn't help...
I have also delete folder with git SSH keys.
When I commit I get a message: Committer: Xxx Xxx <[email protected]> Your name and email address were configured automatically based on your username and hostname. But this email [email protected] differs from my github account email... Why still git recognizes password and username?

3
  • 1
    Are you using an ssh key? Do you want it to push to GitHub? Commented Sep 14, 2018 at 21:26
  • I'm not using SSH key becuz I delete thefolder containing it from my computer. Yes, I push it to github. Commented Sep 14, 2018 at 22:01
  • Does this answer your question? Remove sensitive files and their commits from Git history Commented Aug 26, 2020 at 14:08

2 Answers 2

2

Just using --unset instead of --unset-all worked for me to delete my password to put my new SSH token.

So git config --global --unset user.password and then any git action that requires credentials triggers the login with user and password again

Sign up to request clarification or add additional context in comments.

Comments

1

One of two things has happened:

  • Your Git repository is unprotected and you allow anonymous pushes to it.
  • Your Git repository is configured with an SSH key that is on your local machine.

If you want to require that Git ask you for a username and password, then you need to not use the git:// protocol; simply using the https:// protocol will address the issue.

To do this, change the remote branches of your repository to https.

git remote set-url origin https://github.com/USERNAME/REPOSITORY.git

2 Comments

Third option: a password manager stores the user name and password
1. In another computer I must provide user.name and password when I want to push to my account. 2. I have deleted folder with SSH keys on my computer. 3. remote url origin is https:// When I do commit I get message: ` Committer: Xxx Xxx <[email protected]> Your name and email address were configured automatically based on your username and hostname. But this email [email protected] differs from my github account email...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.