# Drone could not clone private repo on gitlab

**URL:** <https://drone.discourse.group/t/drone-could-not-clone-private-repo-on-gitlab/9827>\
**Category:** Drone Support\
**Created:** [January 6, 2017, 8:45am UTC](https://drone.discourse.group/t/drone-could-not-clone-private-repo-on-gitlab/9827 "2017-01-06T08:45:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![EagleChen](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/eaglechen/32/4113_2.png) [@EagleChen](https://drone.discourse.group/u/EagleChen)\
**Post date:** [January 6, 2017, 8:45am UTC](https://drone.discourse.group/t/drone-could-not-clone-private-repo-on-gitlab/9827/1 "2017-01-06T08:45:00Z")

</div>

Hello, I’ve set up drone according to the [official guide](http://readme.drone.io/admin/setup-gitlab/).  
But it cannot clone private repo. Here are the outputs:

> + git init  
> Initialized empty Git repository in /drone/src/123.123.123.123/controller/test/.git/
> 
> - git remote add origin [http://123.123.123.123:10080/controller/test.git](http://123.123.123.123:10080/controller/test.git)
> - git fetch --no-tags origin +refs/heads/master:  
> fatal: could not read Username for ‘[http://123.123.123.123:10080](http://123.123.123.123:10080)’: No such device or address  
> exit status 128

And here is my drone yaml file:

> 

pipeline:  
build:  
image: alpine  
commands:  
- echo ‘success’`

my drone version is 0.5. gitlab server version is CE 8.10.1.

Anyone can help me with this?  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [January 6, 2017, 2:36pm UTC](https://drone.discourse.group/t/drone-could-not-clone-private-repo-on-gitlab/9827/2 "2017-01-06T14:36:06Z")

</div>

This error indicates `git clone` fails due to missing username and password. Drone provides username and password for private repositories. The most common reasons one encounters this error are the following:

**Gitlab is running in private mode**

Private mode means public repositories still require username and password to clone. If you have this Gitlab configuration, you need to include `DRONE_GITLAB_PRIVATE_MODE=true` in your server configuration. This instructs Drone to treat public repositories as private, for authentication purposes. Note you will need to delete / re-add your repository for this to work

**Repository changed to private**

Sometimes people add a public repository to Drone, but then change the repository to private in Gitlab. The result is that Drone attempts to clone the repository without username and password, and it fails because the repository is now private. To resolve this issue, you need to remove and re-add the repository so it is correctly labeled as private.

---

<div class="post-metadata">

**Author:** ![EagleChen](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/eaglechen/32/4113_2.png) [@EagleChen](https://drone.discourse.group/u/EagleChen)\
**Post date:** [January 6, 2017, 3:51pm UTC](https://drone.discourse.group/t/drone-could-not-clone-private-repo-on-gitlab/9827/3 "2017-01-06T15:51:42Z")

</div>

Thanks for your reply.

1. I can clone public repos on my machine using:

> git clone [http://123.123.123.123:10080/controller/public\_test.git](http://123.123.123.123:10080/controller/public_test.git)

```
So I suppose the gitlab server is not in "private_mode".

```

1. The repo test is “private” from the beginning.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [January 6, 2017, 4:13pm UTC](https://drone.discourse.group/t/drone-could-not-clone-private-repo-on-gitlab/9827/4 "2017-01-06T16:13:21Z")

</div>

It could also be a network issue and not a drone issue. Can you clone your repository from inside a Docker container?

```auto
docker run -t -i golang:1.6 git clone http://123.123.123.123:10080/controller/public_test.git

```

> So I suppose the gitlab server is not in “private\_mode”.

your local git client could have the credentials cached. The way to know if GitLab is running in private mode is to open a browser in an incognito window and visit your repository in GitLab. If you need to login to view your repository, it is private mode.

> Should I also set DRONE\_GITLAB\_GIT\_USERNAME and DRONE\_GITLAB\_GIT\_PASSWORD

nope

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [January 6, 2017, 4:15pm UTC](https://drone.discourse.group/t/drone-could-not-clone-private-repo-on-gitlab/9827/5 "2017-01-06T16:15:25Z")

</div>

also feel free to look through issues where other individuals have reported and solved similar issues with the gitlab configurations

1. [https://github.com/drone/drone/issues/1177](https://github.com/drone/drone/issues/1177)
2. [https://github.com/drone/drone/issues/1223](https://github.com/drone/drone/issues/1223)

---

<div class="post-metadata">

**Author:** ![EagleChen](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/eaglechen/32/4113_2.png) [@EagleChen](https://drone.discourse.group/u/EagleChen)\
**Post date:** [January 6, 2017, 4:27pm UTC](https://drone.discourse.group/t/drone-could-not-clone-private-repo-on-gitlab/9827/6 "2017-01-06T16:27:53Z")

</div>

OK.  
I will investigate.

Thanks again 🙂
