Reputation: 305
I'm trying to use a username and a password for a git push but I cannot find the options to use with the git command.
I've tried: http://username@gitserver/project
Can anyone help?
Upvotes: 3
Views: 12772
Reputation: 256
Git leaves authentication to the used protocol, like ssh
or http
in your case, therefore the authentication method may not even be password-based.
I presume you want to do automatic authentication, in that case you can use key-based ssh. Github has an example how to do that.
If you're rolling your own Git server, then you need to add your key fingerprint to the authorized_keys
, see the relevant question.
Upvotes: 1
Reputation: 54437
Typically, you don't provide the credentials in the URL. It's OK to have the username in there like you did - Git will then ask for the password.
You could try adding the password like this, but it's not a good idea, since it means having the password in plain text, issues with special characters/encoding, etc.:
http://username:password@gitserver/project
I'm not sure what you're trying to do, but in general, it's better to use a credential helper to store passwords so you don't have to reenter them every time: https://help.github.com/articles/caching-your-github-password-in-git - this page has instructions for the most common operating systems.
Upvotes: 2