0

I wish to configure git config in such a way so that the command git commit -m "some text" will always prompt for the username AND password. Is this possible, and if so - how?


I'm on git 2.6.3 and I'm working with a private github repository which I clone onto my machine like this:

clone git https://github.com/user/private-repo.git

...and it will prompt me for my username and password.

I can then perform a git add some_file but when I execute git commit -m "hello" I get this:

*** Please tell me who you are

Run

git config --global user.email "you@example.com"
git config --globl user.name "Your name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident name (for <fredrik@devcentos6.(none)>) not allowed

I am aware of that you can use the -c option to define a user:

git -c "user.name=Your Name" -c "user.email=Your email" commit -m "hello"

However, I would want to get a username/password prompt upon simply executing git commit -m "hello". Is it possible to configure git config in such a way? I will be using different usernames for different commits.

fredrik
  • 9,631
  • 16
  • 72
  • 132
  • 2
    Possible duplicate of [Override configured user for a single git commit](http://stackoverflow.com/questions/19840921/override-configured-user-for-a-single-git-commit) – Mehdi Nov 18 '15 at 12:34
  • 1
    What username/password are you expecting git to prompt for? After all, you don't need to log into anything just to commit. – David Z Nov 18 '15 at 12:34

1 Answers1

-1

if you pass the --global option, because then Git will always use that information for anything you do on that system. If you want to override this with a different name or email address for specific projects, you can run the command without the --global option when you’re in that project. Source

So it is possible to save identity for specific project. If I recall correctly configurations specific for repositories are stored in the repository .git/config.

Konrad 'Zegis'
  • 15,101
  • 1
  • 16
  • 18