Error during specs scan - GitCommandException
Asked by Rafael Neris:

Error during specs scan for Bamboo version 8.2.3 and Git 2.37.3 :  

```
Error during specs scan:com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.plugins.git.GitCommandException: command [/usr/local/bin/git remote set-url origin file:///data/atlassian-bamboo-8.2.4/local-working-dir/_git-repositories-cache/6dc9b77d8e89ef31d4172c3f3d4ed5f214a6a191] failed with code 128. Working directory was [/data/atlassian-bamboo-8.2.4/local-working-dir/serverSide/REPOSITORY_STORED_SPECS/repository-82673736-master/checkout]., stderr:fatal: not a git repository (or any parent up to mount point /)Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).	at com.atlassian.bamboo.plugins.stash.v2.BitbucketServerWorkingCopyManager.updateToLatestRevision(BitbucketServerWorkingCopyManager.java:150)	at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl.lambda$runBambooSpecs$0(RepositoryStoredSpecsServiceImpl.java:164)	at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:140)	at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl.lambda$runBambooSpecs$1(RepositoryStoredSpecsServiceImpl.java:169)	at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:126)	at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl.runBambooSpecs(RepositoryStoredSpecsServiceImpl.java:167)	at com.atlassian.bamboo.configuration.external.RssDetectionServiceImpl.runRssDetection(RssDetectionServiceImpl.java:374)	at com.atlassian.bamboo.configuration.external.detection.RssDetectionRunnable.run(RssDetectionRunnable.java:42)	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)	at java.util.concurrent.FutureTask.run(FutureTask.java:266)	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)	at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)	at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)	at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)	at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)	at java.lang.Thread.run(Thread.java:748)Caused by: com.atlassian.bamboo.plugins.git.GitCommandException: command [/usr/local/bin/git remote set-url origin file:///data/atlassian-bamboo-8.2.4/local-working-dir/_git-repositories-cache/6dc9b77d8e89ef31d4172c3f3d4ed5f214a6a191] failed with code 128. Working directory was [/data/atlassian-bamboo-8.2.4/local-working-dir/serverSide/REPOSITORY_STORED_SPECS/repository-82673736-master/checkout]., stderr:fatal: not a git repository (or any parent up to mount point /)Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).	at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:773)	at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:702)	at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:693)	at com.atlassian.bamboo.plugins.git.GitCommandProcessor.setOrigin(GitCommandProcessor.java:597)	at com.atlassian.bamboo.plugins.git.GitCommandProcessor.setOriginToLocalDirectory(GitCommandProcessor.java:654)	at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.checkout(NativeGitOperationHelper.java:505)	at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.lambda$checkout$1(GitWorkingCopyManager.java:246)	at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:293)	at com.atlassian.bamboo.plugins.git.GitCacheDirectory$LoggingManagedLock.withLock(GitCacheDirectory.java:44)	at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.checkout(GitWorkingCopyManager.java:234)	at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.updateToLatestRevision(GitWorkingCopyManager.java:136)	at com.atlassian.bamboo.plugins.stash.v2.BitbucketServerWorkingCopyManager.updateToLatestRevision(BitbucketServerWorkingCopyManager.java:146)	... 16 more
```


Answers:
author: Eduardo Alvarenga
body: Hello [@Rafael Neris](/t5/user/viewprofilepage/user-id/4829404)

It appears that the local Git cache on the Bamboo Server is corrupted. Please follow the instructions below:

1. **Bamboo Administration** \>\> **Overview** \>\> **Repository settings**
2. Locate***6dc9b77d8e89ef31d4172c3f3d4ed5f214a6a191*** \>\> **Delete**

Wait some minutes so Bamboo can run the deletion tasks and try the Specs scan again.

Best regards,

Eduardo Alvarenga  
Atlassian Support APAC

**--please don't forget to Accept the answer if the reply is helpful--**

comments: author: Rafael Neris
body: Hi [@Eduardo Alvarenga](/t5/user/viewprofilepage/user-id/4365410) !  

Thanks for the help, but the problem persisted. There is something else we can do, here is the updated log:  

```
Error during specs scan:com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.plugins.git.GitCommandException: command [/usr/local/bin/git remote set-url origin file:///data/atlassian-bamboo-8.2.4/local-working-dir/_git-repositories-cache/6dc9b77d8e89ef31d4172c3f3d4ed5f214a6a191] failed with code 128. Working directory was [/data/atlassian-bamboo-8.2.4/local-working-dir/serverSide/REPOSITORY_STORED_SPECS/repository-82673736-master/checkout]., stderr:fatal: not a git repository (or any parent up to mount point /)Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). at com.atlassian.bamboo.plugins.stash.v2.BitbucketServerWorkingCopyManager.updateToLatestRevision(BitbucketServerWorkingCopyManager.java:150) at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl.lambda$runBambooSpecs$0(RepositoryStoredSpecsServiceImpl.java:164) at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:140) at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl.lambda$runBambooSpecs$1(RepositoryStoredSpecsServiceImpl.java:169) at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:126) at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl.runBambooSpecs(RepositoryStoredSpecsServiceImpl.java:167) at com.atlassian.bamboo.configuration.external.RssDetectionServiceImpl.runRssDetection(RssDetectionServiceImpl.java:374) at com.atlassian.bamboo.configuration.external.detection.RssDetectionRunnable.run(RssDetectionRunnable.java:42) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48) at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26) at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17) at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41) at java.lang.Thread.run(Thread.java:748)Caused by: com.atlassian.bamboo.plugins.git.GitCommandException: command [/usr/local/bin/git remote set-url origin file:///data/atlassian-bamboo-8.2.4/local-working-dir/_git-repositories-cache/6dc9b77d8e89ef31d4172c3f3d4ed5f214a6a191] failed with code 128. Working directory was [/data/atlassian-bamboo-8.2.4/local-working-dir/serverSide/REPOSITORY_STORED_SPECS/repository-82673736-master/checkout]., stderr:fatal: not a git repository (or any parent up to mount point /)Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:773) at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:702) at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:693) at com.atlassian.bamboo.plugins.git.GitCommandProcessor.setOrigin(GitCommandProcessor.java:597) at com.atlassian.bamboo.plugins.git.GitCommandProcessor.setOriginToLocalDirectory(GitCommandProcessor.java:654) at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.checkout(NativeGitOperationHelper.java:505) at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.lambda$checkout$1(GitWorkingCopyManager.java:246) at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:293) at com.atlassian.bamboo.plugins.git.GitCacheDirectory$LoggingManagedLock.withLock(GitCacheDirectory.java:44) at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.checkout(GitWorkingCopyManager.java:234) at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.updateToLatestRevision(GitWorkingCopyManager.java:136) at com.atlassian.bamboo.plugins.stash.v2.BitbucketServerWorkingCopyManager.updateToLatestRevision(BitbucketServerWorkingCopyManager.java:146) ... 16 more
```


author: Eduardo Alvarenga
body: Hello [@Rafael Neris](/t5/user/viewprofilepage/user-id/4829404)

As the git cache folder was not the issue, you can try:

* Remove the **/data/atlassian-bamboo-8.2.4/local-working-dir/serverSide/REPOSITORY_STORED_SPECS/repository-82673736-master** folder
* Check if you are not running out of disk space
* Is this Repository using submodules? You may have come into a bug [BAM-21880](https://jira.atlassian.com/browse/BAM-21880)

If you still have issues, please raise a ticket with Atlassian at <https://support.atlassian.com/contact> and we'll be happy to assist.

Cheers,

Eduardo Alvarenga  
Atlassian Support APAC

**--please don't forget to Accept the answer if the reply is helpful--**