gitlab - push using https, specifying username & password
Like others mentioned here, ssh is preferred. But for those you want to use just http/https, you can specify credentials like this:
git remote add origin https://username:[email protected]:group1/project1.git
Verified for gitlab 9.0
Note: Please replace '@' symbols in username with '%40' to work this.
When you created the repo in gitlab, by deafault it will provide to clone git repo using two protocols, ssh and https. Where in https it will prompt your user credential every time you pull or push.
I prefer to use ssh. Where as in ssh you can push lot of files to repo. In https you have size restriction. Perhaps you want push 4gb files to repo.
Follow these steps to set ssh as remote:
git remote rm https://gitlab.example.com:group1/project1.git
git remote set-url origin ssh://user@host:1234/srv/git/example
Useful information:
Worth reading about setting up git remote:
https://help.github.com/articles/changing-a-remote-s-url/