I've cloned my private Github repository onto my CentOS 6 machine (git version 1.7.1). Can I somehow set up my local git repository to always prompt for both username and password when typing in git push
?
The same username is not always going to be used.
$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://github.com/USER/PRIVATE-REPO.git
[branch "master"]
remote = origin
merge = refs/heads/master
When I perform git push
right now I get this:
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/Industriromantik/render-linux.git/info/refs
fatal: HTTP request failed
If I execute the following, the push is successful:
git push https://[email protected]/USER/PRIVATE-REPO
...however, I am seeking to just execute git push
and get prompted for both username and password, if at all possible.
Clone the repository using https://
$ git clone https://github.com/user/private-repo.git/
Since (it seems that) https connections don't cache the password (nor the username, unless you give it in the URL), git will always ask you for the password (and the username):
$ git push
Username for 'https://github.com': USER
Password for 'https://[email protected]': ****
$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With