Jake Jake - 8 months ago 111
Git Question

Username and password in command for git push

It's possible to clone down a git repository, specifying username and password in the command. Example:

git clone https://username:password@myrepository.biz/file.git

Is it is possible to also specify the username and password when pushing? So that, for example, running
git push origin --all
will then output asking for a password. I want this in one command.

(I am aware of the ability to set up keys and other solutions, but I want to know if there is a way to just keep using username and password with one command.) I am running Git Bash on Windows 8.1.


Yes, you can do

git push https://username:password@myrepository.biz/file.git --all

in this case https://username:password@myrepository.biz/file.git replace the origin in git push origin --all

To see more options for git push, try git help push