# Gitlab merge request failure on git-clone step (if PR is sent from a private fork)

**URL:** <https://discuss.bitrise.io/t/gitlab-merge-request-failure-on-git-clone-step-if-pr-is-sent-from-a-private-fork/4603>\
**Category:** Builds\
**Tags:** gitlab\
**Created:** [March 26, 2018, 3:43pm UTC](https://discuss.bitrise.io/t/gitlab-merge-request-failure-on-git-clone-step-if-pr-is-sent-from-a-private-fork/4603 "2018-03-26T15:43:47Z")\
**Posts on this page:** 11\
**Page:** 1

<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 26, 2018, 3:43pm UTC](https://discuss.bitrise.io/t/gitlab-merge-request-failure-on-git-clone-step-if-pr-is-sent-from-a-private-fork/4603/1 "2018-03-26T15:43:47Z")

</div>

# Bitrise Build Issue Report template

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.

## Environment:

**Where did the issue happen?**

If on [Bitrise.io](http://Bitrise.io): which stack? If not on [Bitrise.io](http://Bitrise.io): on what operating system? (Plus any other information you can share)

On [Bitrise.io](http://Bitrise.io): Xcode 9.2.x, on macOS 10.12 (Sierra)

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

E.g.: Git Clone Repository v4.0.10

## 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 environment.

## 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:** [March 26, 2018, 3:58pm UTC](https://discuss.bitrise.io/t/gitlab-merge-request-failure-on-git-clone-step-if-pr-is-sent-from-a-private-fork/4603/2 "2018-03-26T15:58:42Z")

</div>

Hi @ituaijagbone,

Can you please enable the “manual merge” mode? It seems you disabled that in your `primary` workflow:

```auto
    - git-clone@4.0.10:
        inputs:
        - manual_merge: 'no'

```

Change it back to the default `'yes'`, that should help.

If it wouldn’t, or if you’d have any questions just let us know! 😉

---

<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, 4:00pm UTC](https://discuss.bitrise.io/t/gitlab-merge-request-failure-on-git-clone-step-if-pr-is-sent-from-a-private-fork/4603/3 "2018-03-26T16:00:55Z")

</div>

P.S.: on the web UI / in the Workflow Editor the **Manual merge** option of the `Git Clone` step can be found in the **Clone Config** input category / group. Select the **Git Clone** step then expand **Clone Config** category, the last option is **Manual merge**.

---

<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 26, 2018, 4:06pm UTC](https://discuss.bitrise.io/t/gitlab-merge-request-failure-on-git-clone-step-if-pr-is-sent-from-a-private-fork/4603/4 "2018-03-26T16:06:17Z")

</div>

@viktorbenei I have set the Manual merge option to Yes. I still get the same error:

> **[Bitrise - Mobile Continuous Integration and Delivery](https://app.bitrise.io/users/sign_in)**
>
> Mobile Continuous Integration and Delivery for your whole team, with dozens of integrations for your favourite services.

---

<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, 4:39pm UTC](https://discuss.bitrise.io/t/gitlab-merge-request-failure-on-git-clone-step-if-pr-is-sent-from-a-private-fork/4603/5 "2018-03-26T16:39:41Z")

</div>

Thanks for the report & for all the infos @ituaijagbone! We’ll try to debug & fix this as quick as possible, in the meantime if possible please send your gitlab PRs from the same repo or from a public fork (this issue only happens if the PR is sent from a private fork on gitlab).

---

<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 26, 2018, 5:26pm UTC](https://discuss.bitrise.io/t/gitlab-merge-request-failure-on-git-clone-step-if-pr-is-sent-from-a-private-fork/4603/6 "2018-03-26T17:26:47Z")

</div>

Thanks @viktorbenei. I will create PR from the same repo for the time being.

---

<div class="post-metadata">

**Author:** ![sb\_ronaldopace](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@sb\_ronaldopace](https://discuss.bitrise.io/u/sb_ronaldopace)\
**Post date:** [March 29, 2018, 9:26am UTC](https://discuss.bitrise.io/t/gitlab-merge-request-failure-on-git-clone-step-if-pr-is-sent-from-a-private-fork/4603/7 "2018-03-29T09:26:59Z")

</div>

I’ll just add to this issue. Every test workflow is failing because git-clone fails.  
We’re running from a private gitlab, which bitrise has access and webhooks are in place.  
There’s no fork here. Just 1 repo, and Pull Request from one branch to another.  
Every Pull-Request to master we’re (trying to) run our `test` workflow and it fails.

the clone config is defaul: `- git-clone: {}`

error log:

```auto
git "init"
Initialized empty Git repository in /bitrise/src/.git/
git "remote" "add" "origin" "git@<our_gitlab_instance/our_repo>"
git "fetch" "origin" "master"
Warning: Permanently added '<url and IP>' (ECDSA) to the list of known hosts.
From <our_gitlab_instance/our_repo>
 * branch master -> FETCH_HEAD
 * [new branch] master -> origin/master
git "checkout" "master"
Already on 'master'
Branch master set up to track remote branch master from origin.
git "merge" "origin/master"
Already up-to-date.
commit hash: <some hash>
git "fetch" "origin" "hotfix/crash_3"
fatal: Couldn't find remote ref hotfix/crash_3
ERROR: manual merge, error: fetch failed, error: exit status 128

```

I hope it helps.

---

<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 29, 2018, 11:55am UTC](https://discuss.bitrise.io/t/gitlab-merge-request-failure-on-git-clone-step-if-pr-is-sent-from-a-private-fork/4603/8 "2018-03-29T11:55:14Z")

</div>

Hi @sb_ronaldopace,

Thanks for the infos but your issue seems to be unrelated. The original issue is specific for fork based PRs, where the PR source is in a private fork repo.  
Can you please ping our support via the onsite chat, or create a new / separate issue here?

---

<div class="post-metadata">

**Author:** ![ashiq](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@ashiq](https://discuss.bitrise.io/u/ashiq)\
**Post date:** [June 1, 2018, 6:48am UTC](https://discuss.bitrise.io/t/gitlab-merge-request-failure-on-git-clone-step-if-pr-is-sent-from-a-private-fork/4603/9 "2018-06-01T06:48:54Z")

</div>

> [@viktorbenei](#):
>
> e send your gitlab PRs from the same repo or from a public fork (this issue only happens if the PR is sent from a private fork on gitlab).

I am still facing the same issue. I am getting this response in the log  
exit status 128  
ERROR: checkout (expTest): Fetch failed, error: exit status 128  
| |  
±–±--------------------------------------------------------------±---------+  
| x | git-clone@4.0.10 (exit code: 1) | 5.42 sec |

---

<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:** [June 5, 2018, 3:51pm UTC](https://discuss.bitrise.io/t/gitlab-merge-request-failure-on-git-clone-step-if-pr-is-sent-from-a-private-fork/4603/10 "2018-06-05T15:51:10Z")

</div>

@ashiq please fill out a new #issues:build-issues report so that we can help you as quickly as possible! 🙂

---

<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:** [June 5, 2018, 3:51pm UTC](https://discuss.bitrise.io/t/gitlab-merge-request-failure-on-git-clone-step-if-pr-is-sent-from-a-private-fork/4603/11 "2018-06-05T15:51:13Z")

</div>

Closed on June 5, 2018, 3:51pm UTC


