# Deployment failed with self-hosted gitlab repo

**URL:** <https://answers.netlify.com/t/deployment-failed-with-self-hosted-gitlab-repo/40852>\
**Category:** Support\
**Tags:** deployment\
**Created:** [July 13, 2021, 6:27am UTC](https://answers.netlify.com/t/deployment-failed-with-self-hosted-gitlab-repo/40852 "2021-07-13T06:27:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DarkoArnautov](https://avatars.discourse-cdn.com/v4/letter/d/41988e/32.png) [@DarkoArnautov](https://answers.netlify.com/u/DarkoArnautov)\
**Post date:** [July 13, 2021, 6:27am UTC](https://answers.netlify.com/t/deployment-failed-with-self-hosted-gitlab-repo/40852/1 "2021-07-13T06:27:54Z")

</div>

Our team Netlify account is the business plan.  
And we did connect the self-hosted repo(APP ID, ssh key was set up).  
Btw, when build, this issue has occurred.

7:52:24 PM: Build ready to start  
7:52:26 PM: build-image version: 2cee85eb7f808bf3b6e87378c5307f9411f0a332  
7:52:26 PM: build-image tag: v3.8.0  
7:52:26 PM: buildbot version: d9a660540b05c414edfc0246347871ef0e3afee9  
7:52:26 PM: Building without cache  
7:52:26 PM: Starting to prepare the repo for build  
7:54:01 PM: User git error while checking for ref refs/heads/main  
7:54:02 PM: Creating deploy upload records  
7:54:02 PM: Failing build: Failed to prepare repo

7:54:02 PM: Failed during stage ‘preparing repo’: error checking for ref: ssh: connect to host [gitlab.idkit.co](http://gitlab.idkit.co) port 22: Connection timed out  
fatal: Could not read from remote repository.

Please make sure you have the correct access rights  
and the repository exists.  
: exit status 128

7:54:02 PM: Finished processing build request in 1m35.481881319s

As I see, this issue is very specific to Netlify being able to pull via SSH on a different url than the http endpoint.  
Is there any way to solve this?

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [July 13, 2021, 8:11am UTC](https://answers.netlify.com/t/deployment-failed-with-self-hosted-gitlab-repo/40852/2 "2021-07-13T08:11:05Z")

</div>

Hi @DarkoArnautov,

Before we dig in further, just to eliminate the primitive causes, could you please confirm if you’ve followed the guide: [Self-hosted Git | Netlify Docs](https://docs.netlify.com/configure-builds/repo-permissions-linking/self-hosted-git/#gitlab-self-managed)?

If that’s all good to go, could you check the permissions on port 22? Like in this thread, they had closed it off: [Any way to set custom ssh port for self-hosted Gitlab?](https://answers.netlify.com/t/any-way-to-set-custom-ssh-port-for-self-hosted-gitlab/29978).

---

<div class="post-metadata">

**Author:** ![DarkoArnautov](https://avatars.discourse-cdn.com/v4/letter/d/41988e/32.png) [@DarkoArnautov](https://answers.netlify.com/u/DarkoArnautov)\
**Post date:** [July 13, 2021, 4:36pm UTC](https://answers.netlify.com/t/deployment-failed-with-self-hosted-gitlab-repo/40852/4 "2021-07-13T16:36:18Z")

</div>

Hi, Hrishikesh.  
Thanks for your response.

Yes, I did follow that guide.  
Also, I did check that thread.

But, there is no way to fix this issue.

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [July 14, 2021, 8:03am UTC](https://answers.netlify.com/t/deployment-failed-with-self-hosted-gitlab-repo/40852/5 "2021-07-14T08:03:35Z")

</div>

Hi @DarkoArnautov,

This would be possible with some additional config at the moment. Do you mind sharing your site name or ID or if that should be kept private, we could escalate this to helpdesk.
