2

I just want to disable git from using publickey entirely and start asking me for username and password everytime I push and pull.

How can I do that? Thanks!

v_i_m
  • 171
  • 1
  • 2
  • 6
  • 1
    Why? Public key auth is more secure over SSH. – mipadi Aug 25 '15 at 20:51
  • I know. I can't explain a 50 year old how to generate a public/private key in windows, then upload it into git, and then fail when the user will go to another machine where there will not be this key. I just need to use a git in my local network without all this public/private key thing – v_i_m Aug 25 '15 at 20:56
  • How are you setting up your remotes? I had the opposite problem , it always asked me for u/p every time and it took me a while to figure out how to change that. – M.M Aug 25 '15 at 22:05
  • If your user doesn't *have* a public key, Git will ask every time, no? Are you the admin for their remote? – tripleee Jan 02 '20 at 04:59

3 Answers3

1

You can have Git store your credentials permanently using the following in your laptop:

git config credential.helper store

If you want Git to resume to asking you for credentials every time it needs to connect to the remote repository, you can run this command:

git config --unset credential.helper
Arjang
  • 731
  • 1
  • 10
  • 19
0

Its enough to remove ssh key. Comprehend description can be found here: How to remove a ssh key?

Community
  • 1
  • 1
CyberGuy
  • 2,783
  • 1
  • 21
  • 31
  • I have no key to remove. I wish I can just tell git to ignore the whole keys auth altogether and just use username and password. Just like ftp. – v_i_m Aug 25 '15 at 21:11
0

Edit (by @tarikmanoar as suggested by moderators and comments)

WARNING: If you use credential.helper store from the answer, your password is going to be stored completely unencrypted ("as is") at ~/.git-credentials. Please consult the comments section below or the answers from the "Linked" section, especially if your employer has zero-tolerance for security issues.

Even though accepted, it doesn't answer the actual OP's question about omitting a username only (no password). For the readers with that exact problem @grawity's answer might come in handy.


Original answer (by @Alexander Zhu):

You can store your credentials using the following command

$ git config credential.helper store
$ git push http://example.com/repo.git
Username: <type your username>
Password: <type your password>

Also, I suggest you read
$ git help credentials

Tarik Manoar
  • 151
  • 3
  • 10