"fatal: --local can only be used inside a git repository"

Hi VS,

So in one pipeline/workspace you:

  • check out & analyze project 1 - successfully
  • clean out the workspace
  • check out project 2 - and here there’s an error when analysis is included in the pipeline

I don’t understand why you would structure it like this instead of having a job/pipeline per project.

And here’s what I see in the step 7 log:

2022-12-13T15:39:44.6669975Z Syncing repository: ***/repo2
...
2022-12-13T15:39:44.6678343Z Working directory is '/home/runner/work/repo1/repo1'

So you’ve synched repo2 into the repo1 working directory…

2022-12-13T15:39:44.6850796Z Adding repository directory to the temporary git global config as a safe directory
2022-12-13T15:39:44.6856603Z [command]/usr/bin/git config --global --add safe.directory /home/runner/work/repo1/repo1
2022-12-13T15:39:44.6907822Z [command]/usr/bin/git config --local --get remote.origin.url
2022-12-13T15:39:44.6939725Z https://github.com/***/repo1
2022-12-13T15:39:44.6947533Z Deleting the contents of '/home/runner/work/repo1/repo1'

And then you delete all the contents of the directory, including presumably the .git directory, which marks it as a git repository


2022-12-13T15:39:44.7110349Z [command]/usr/bin/git config --local --name-only --get-regexp core.sshCommand
2022-12-13T15:39:44.7167766Z ##[error]fatal: --local can only be used inside a git repository

And then you experience an error because it’s not a git repository.

This seems unrelated to analysis to me…

 
Ann