# Gitlab merge request issue on git-clone step

**URL:** <https://discuss.bitrise.io/t/gitlab-merge-request-issue-on-git-clone-step/3887>\
**Category:** Builds\
**Tags:** step, gitlab\
**Created:** [January 25, 2018, 9:41am UTC](https://discuss.bitrise.io/t/gitlab-merge-request-issue-on-git-clone-step/3887 "2018-01-25T09:41:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![RBonaventure](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/rbonaventure/32/1027_2.png) [@RBonaventure](https://discuss.bitrise.io/u/RBonaventure)\
**Post date:** [January 25, 2018, 9:41am UTC](https://discuss.bitrise.io/t/gitlab-merge-request-issue-on-git-clone-step/3887/1 "2018-01-25T09:41:27Z")

</div>

# Bitrise Build Issue Report template

## Description of the issue

I configured a trigger to run a build on Gitlab merge requests.  
The build gets triggered but the git-clone step gives an error :  
ERROR: auto merge, error: there is no Pull Request branch and can’t download diff file

## Environment:

**Where did the issue happen?**

Android & Docker, on Ubuntu 16.04

**Which build Step causes the issue and which version of the step?**

id: git-clone  
version: 4.0.5

## Reproducibility

- _Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build)_ : NO
- _Does a rebuild without caches help? (You can remove the `Cache:Pull` and `Cache:Push` steps temporarily to not to use the cache, or [you can delete all the caches on the `Settings` tab of the app](http://devcenter.bitrise.io/caching/about-caching/#downloading-and-deleting-caches)._ : NO
- _Does the issue happen sporadically, or every time?_ : Every time
- _Does upgrading the build Step to the latest version help?_ : NO
- _When did the issue start?_ : On the first merge request I submitted after the webhook was setup

### Local reproduction

I don’t have a local environnement.

## Build log

> **[Log in - Bitrise](https://app.bitrise.io/users/sign_in)**
>
> Bringing back the joy of iOS & Android development through automating build, testing and support cycles.

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [January 25, 2018, 12:26pm UTC](https://discuss.bitrise.io/t/gitlab-merge-request-issue-on-git-clone-step/3887/2 "2018-01-25T12:26:49Z")

</div>

Hi @RBonaventure,

Thanks for reporting the issue here!

Can you please normalize the git clone URL on the **Settings** tab of the app?

It seems right now you have a URL like this, with **ssh://** prefix and **port number** included:

```auto
ssh://git@X.com:23/Y/Z.git

```

can you please normalize this into the simplified format, without the prefix & without the port number:

```auto
git@X.com:Y/Z.git

```

For the actual value please check the Git Clone step’s log, the **PRRepositoryCloneURL** line. There you can see the normalized value which was provided by your GitLab server.

Simply set that on the **Settings** tab, and I think the Git Clone step then can detect that the PR is from the same repo.

The issue seems that the step right now thinks these are two separate private repos, where it has to fallback to alternative approaches to determine the diffs (which right now is only implemented for GitHub and Bitbucket). But in reality it’s the same repo, so this shouldn’t even be necessary.

I’ll also create a bug report for the step, to make it able to match these URLs and detect these are the same.

If you’d have any questions just let us know! 🙂

---

<div class="post-metadata">

**Author:** ![anon389916](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anon389916](https://discuss.bitrise.io/u/anon389916)\
**Post date:** [March 5, 2018, 9:04am UTC](https://discuss.bitrise.io/t/gitlab-merge-request-issue-on-git-clone-step/3887/3 "2018-03-05T09:04:42Z")

</div>

Hi @RBonaventure,

We released a fix for the issue in version [4.0.9](https://github.com/bitrise-io/steps-git-clone/releases/tag/4.0.9). From this version the repository url can be in the form of `ssh://git@hostname:port/owner/repository.git`

---

<div class="post-metadata">

**Author:** ![RBonaventure](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/rbonaventure/32/1027_2.png) [@RBonaventure](https://discuss.bitrise.io/u/RBonaventure)\
**Post date:** [March 5, 2018, 12:27pm UTC](https://discuss.bitrise.io/t/gitlab-merge-request-issue-on-git-clone-step/3887/4 "2018-03-05T12:27:58Z")

</div>

Awesome, thanks !

---

<div class="post-metadata">

**Author:** ![ituaijagbone](https://avatars.discourse-cdn.com/v4/letter/i/85e7bf/32.png) [@ituaijagbone](https://discuss.bitrise.io/u/ituaijagbone)\
**Post date:** [March 24, 2018, 9:02am UTC](https://discuss.bitrise.io/t/gitlab-merge-request-issue-on-git-clone-step/3887/5 "2018-03-24T09:02:57Z")

</div>

Hi @viktorbenei and @kdobmayer , I am currently having this issues with my builds. When I create a merge(pull) request on gitlab, the webhook triggers the build however the build fails at due to:

```auto
git "init"
Initialized empty Git repository in /Users/vagrant/git/.git/
git "remote" "add" "origin" "git@gitlab.com:X/Y.git"
git "fetch" "origin" "master"
Warning: Permanently added 'gitlab.com,xx.xxx.xxx.xxx' (ECDSA) to the list of known hosts.
From gitlab.com:X/Y
 * branch master -> FETCH_HEAD
 * [new branch] master -> origin/master
ERROR: auto merge, error: there is no Pull Request branch and can't download diff file
| |
+---+---------------------------------------------------------------+----------+
| x | git-clone@4.0.10 (exit code: 1) | 9.14 sec |
+---+---------------------------------------------------------------+----------+

```

I am making a merge request from a private repo to another private repo. I have used the generate SSH keypair to copy the ssh public key from bitrise to both private repos and I still get the above.

To note, when I create a merge request within the same repo, it works as expected.

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [March 26, 2018, 2:35pm UTC](https://discuss.bitrise.io/t/gitlab-merge-request-issue-on-git-clone-step/3887/6 "2018-03-26T14:35:16Z")

</div>

Hi @ituaijagbone,

Your issue doesn’t seem to be related to the original issue reported here - please create a new one at [http://discuss.bitrise.io/c/issues/build-issues](http://discuss.bitrise.io/c/issues/build-issues) and we’ll check it ASAP! 🙂

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [March 26, 2018, 2:35pm UTC](https://discuss.bitrise.io/t/gitlab-merge-request-issue-on-git-clone-step/3887/7 "2018-03-26T14:35:19Z")

</div>

Closed on March 26, 2018, 2:35pm UTC


