In git credential source code, whenever an url field is encountered it will call credential_from_url_1 which will then call credential_clear on the credential struct. https://github.com/git/git/blob/master/credential.c#L625 This means the credential struct is cleared whenever a url= line is processed, but the documentation does not mention that the url field must be placed before other fields to avoid wiping them. This causes confusing behaviour: $ printf "host=github.com\nusername=A\nprotocol=https" | git credential approve $ printf "username=A\nurl=https://github.com" | git credential fill Password for 'https://SeeStarz@xxxxxxxxxx': protocol=https host=github.com username=SeeStarz password= $ printf "url=https://github.com\nusername=A" | git credential fill protocol=https host=github.com username=A password=B On the second command, due to username being wiped, git credential fill defaults to using ~/.gitconfig which in my case uses the username SeeStarz. The expected behaviour is that both invocations of git credential fill show username=A and password=B. Please consider clarifying this behavior in the documentation or adjusting the implementation to avoid this surprising side effect. Thank you.