# Automatic SCM configuration not working?

**URL:** <https://community.sonatype.com/t/automatic-scm-configuration-not-working/8626>\
**Category:** Sonatype Lifecycle & Firewall\
**Created:** [May 5, 2022, 11:47am UTC](https://community.sonatype.com/t/automatic-scm-configuration-not-working/8626 "2022-05-05T11:47:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rantoniuk](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/rantoniuk/32/2260_2.png) [@rantoniuk](https://community.sonatype.com/u/rantoniuk)\
**Post date:** [May 5, 2022, 11:47am UTC](https://community.sonatype.com/t/automatic-scm-configuration-not-working/8626/1 "2022-05-05T11:47:43Z")

</div>

We are trying to set up [automatic SCM application configuration](https://help.sonatype.com/iqserver/managing/application-management/managing-automatic-source-control).

According to the documentation, when this is enabled, when a nexus-iq-cli scan is done, the SCM for that application should be auto-configured, which is not happening.

The organisation is created, the BitBucket SCM and credentials are configured and working on the on organisation level. If the application SCM url is configured _manually_ for that application, it works fine. However, when it’s not filled, after nexus-iq-cli scan it’s not populated with the discovered git repository url.

---

<div class="post-metadata">

**Author:** ![jyoung](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/jyoung/32/89_2.png) [@jyoung](https://community.sonatype.com/u/jyoung)\
**Post date:** [May 6, 2022, 11:37pm UTC](https://community.sonatype.com/t/automatic-scm-configuration-not-working/8626/2 "2022-05-06T23:37:41Z")

</div>

Hey Radek,

Thanks for posting. This looks like it is best serviced by our support team. Please submit a ticket in the [support portal](https://support.sonatype.com/hc/en-us) and they can help debug what is going wrong with the auto configuration.

Cheers!  
Justin Young  
Director, Product Management

---

<div class="post-metadata">

**Author:** ![rantoniuk](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/rantoniuk/32/2260_2.png) [@rantoniuk](https://community.sonatype.com/u/rantoniuk)\
**Post date:** [May 10, 2022, 9:54am UTC](https://community.sonatype.com/t/automatic-scm-configuration-not-working/8626/3 "2022-05-10T09:54:45Z")

</div>

I have managed to resolve this issue by checking the -X debug from nexus-iq-cli.  
The problem was in how Bamboo CI system is checking out the git reposity. In the logfile I could see:

```auto
build	[INFO] Discovered repository url 'file:///home/bamboo/build-dir/..........' via jGit
build	[DEBUG] Amending source control record for application with id: X with discovered repository URL

build	[DEBUG] Making external request: POST https://hostname/api/v2/sourceControl?publicId=X&repositoryUrl=file:%2F%2F%2Fhome%2Fbamboo

```

As you see, the discovered git remote is using file:/// instead of https:// and that causes the nexus-iq-cli not setting the SCM repository correctly. The workaround is to run in your CI a curl request with the above parameters and repositoryUrl set correctly to https.

Example command:

```bash
curl -u user -G --request POST --data-urlencode "publicId=appId" --data-urlencode "repositoryUrl=https://path/to/repo.git" https://hostname/api/v2/sourceControl

```
