Drone could not clone private repo on gitlab

Hello, I’ve set up drone according to the official guide.
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/

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.

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.

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

So I suppose the gitlab server is not in "private_mode".
  1. The repo test is “private” from the beginning.

    Currently I only set DRONE_GITLAB_CLIENT and DRONE_GITLAB_SECRET (I got these values from application in gitlab). Should I also set DRONE_GITLAB_GIT_USERNAME and DRONE_GITLAB_GIT_PASSWORD ?

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

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

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
  2. https://github.com/drone/drone/issues/1223

OK.
I will investigate.

Thanks again :slight_smile: