How do I make git ask for credentials (username+password) every time there's a push?
We have a shared host where a logal git repository is taking care of version-controlling a bunch of files. I want to push the repository to a remote location over http, and ask for the username+password every time (since this is a shared host, this ensures we track who was responsible for the last changes).
I have done:
git init
git remote add origin http://remote.host/the_git_repo
However, when I push, I get an HTTP 401 error and no username/password prompt:
[user@thehost ~]# git push -u origin master error: The requested URL returned error: 401 Unauthorized while accessing http://remote.host/the_git_repo/info/refs
fatal: HTTP request failed
The .git/config
file contents:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
askpass = true
[remote "origin"]
url = http://remote.host/the_git_repo
fetch = +refs/heads/*:refs/remotes/origin/*
Notes:
- SSH login is not available for this remote repo
- I have read the documentation about the
SSH_ASKPASS
andGIT_ASKPASS
environment variables, but it is not clear how to use them (export GIT_ASKPASS=1
does nothing) - This is similar to this question, the difference is that the repository was just created and noone has input any credentials yet