I know there are lots of posts about how NOT to be asked for a password when you do a git fetch, but I am trying to recreate a bug that happens when you do get asked for a password when doing a git fetch. I've tried a few different things with oyxkeychain etc. and somehow I just can't recreate a scenario where I get asked for a password when doing a git fetch with bitbucket and with github, doesn't matter which one. Any ideas?
Use the following shell commands:
git init
git remote add origin 'https://nobody@github.com/doot/repo.git'
git fetch origin
It should then ask you for a password.
If your remote URL starts with HTTPS, git uses your.netrc file ( ~/.netrc
) for login credentials. For example, this entry will allow me to push to codeberg.org over HTTPS:
machine codeberg.org
login h3xx
password 0123456789abcdef0123456789abcdef12345678
If the username/password combo is rejected, it'll ask for both username and password.
If you specify the username in the remote URL, eg https://user@codeberg.org/my-repo.git
, it'll only ask for the password.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.