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 <xxx@xxx.com> Your name and email address were configured automatically based on your username and hostname. But this email xxx@xxx.com differs from my github account email... Why still git recognizes password and username?

Ntakwetet
  • 253
  • 2
  • 12
stakowerflol
  • 979
  • 1
  • 11
  • 20

2 Answers2

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

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
Makoto
  • 104,088
  • 27
  • 192
  • 230
  • 1
    Third option: a password manager stores the user name and password – Code-Apprentice Sep 14 '18 at 21:32
  • 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 Your name and email address were configured automatically based on your username and hostname.` But this email xxx@xxx.com differs from my github account email... – stakowerflol Sep 14 '18 at 21:48