Reputation: 35
I have a Git repository with multiple users. When they push, is it possible for me to read arguments from the client command line? For example, username and password?
I tried read
in my bash script, but it does not work. I cannot access STDIN
.
How can I read something from the client command line in a Git hook (update)?
Upvotes: 1
Views: 317
Reputation: 1329292
No. Git doesn't do any authentication. (See "Distributed Version Control Systems and the Enterprise - a Good mix?")
You can get the user id from the https session or the ssh one (if the ~git/.ssh/authorized_keys
file contains that information): that is what gitolite does: see "How do programs like gitolite work?".
You won't certainly get the password. Ever. (And that has nothing to do with git or gitolite).
And gitolite will in turn call git itself (if it authorizes the clone/push/pull command), but git, again, will be blissfully unaware of the user's id requesting said clone/pull/push: it will simply execute it.
Upvotes: 1