I have some private repos on gitlab. If someone happen to know my repo address, will they be able to clone them? I suppose they can't, but what prevent them from cloning? Every time when I clone a repo, no user name nor password is required.
-
Could it be you clone over ssh? – Roland Starke Apr 01 '18 at 05:40
-
Yeah, maybe you authenticate via a key – Evgeniy Malyutin Apr 01 '18 at 05:45
2 Answers
There a two ways to clone a repository.
- Over HTTP
git clone https://gitlab.com/username/reponame.git
- Over SSH
git clone git@gitlab.com:username/reponame.git
The first one viz. http
method will ask you for your credentials and would fail if you provide incorrect details. The second one viz. SSH
method does not require a username/password prompt and will clone the repo without any further action. This method only works if you have added the ssh key of the machine from which you are cloning to the associated Gitlab/Github account.
So to answer you question, will someone be able to clone your repo if they know your repo address?
The answer is a No and Yes. No, one wont be able to clone your repo just by your repo address. Yes, If they can get access to a machine, whose ssh key is associated to your Gitlab account, they would be able to clone your repo without requiring any username/password.

- 3,813
- 2
- 24
- 28
Private repos can only be cloned by your SSH, and the methods are shown here: How can I clone a private Gitlab repo?

- 2,418
- 6
- 22
- 43