2

This solution from this post does not work How to provide username and password when run "git clone git@remote.git"?

git clone https://username:password@github.com/username/repository.git

fatal: unable to access 'http:/..: Could not resolve host: username

mboronin
  • 875
  • 1
  • 10
  • 16

2 Answers2

10

Yes, you can. The syntax is:

git clone https://username:token@gitlab.com/user/repo.git

Where username is your Gitlab username and token is generated through your gitlab's settings > Access Tokens

Dan
  • 810
  • 2
  • 11
  • 29
2

Gitlab doesn't support cloning with http in one line. Maybe you can do it with ssh?

There are a few git services that do work with http cloning in one line. For example Github and Gitorious. I think that Gitlab only supports a username prefix. The password always will be asked. Which also brings in a huge security advantage because in this way, your password never is stored in the logfiles.

Mark Walet
  • 1,147
  • 10
  • 21