Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task fails with error "--local can only be used inside a git repository" #25

Open
fabian-schwarz opened this issue Jul 25, 2023 · 6 comments · May be fixed by #26
Open

Task fails with error "--local can only be used inside a git repository" #25

fabian-schwarz opened this issue Jul 25, 2023 · 6 comments · May be fixed by #26

Comments

@fabian-schwarz
Copy link

The tasks errors out in my pipeline with the error message :

##[error]fatal: --local can only be used inside a git repository

Maybe due to the pipeline checking out more than one repository:

- checkout: self
  persistCredentials: true
- checkout: Scripts

Probably fixed by making the following line configurable:

baseDir: `${tl.getVariable('System.DefaultWorkingDirectory')}`,

@fabian-schwarz fabian-schwarz linked a pull request Jul 25, 2023 that will close this issue
@mlarhrouch
Copy link
Owner

@fabian-schwarz i don't see the reason for configuring the base directory for git, it should be always "System.DefaultWorkingDirectory"

@fabian-schwarz
Copy link
Author

@mlarhrouch you can checkout multiple repositories in Azure Pipelines, thus it is not always "System.DefaultWorkingDirectory"

@mlarhrouch
Copy link
Owner

@fabian-schwarz in this case maybe using "Build.Repository.LocalPath" instead of "System.DefaultWorkingDirectory" is the best solution ?

https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml

@fabian-schwarz
Copy link
Author

@mlarhrouch think this would only do half the job, it would only help if the repo we want to use is the "self" repo, another we can't reach with this variable. Still would love to have the option to define my custom working dir to target any checked out repo, which can default to either "System.DefaultWorkingDirectory" or "Build.Repository.LocalPath".

@snaquekiller
Copy link

we need this fix, i always pull multiple git repos in my pipelines, for multiple reason. i don't want to do a job just for that... i need the fix of that he can use the multiple directory path

@ivanignatiev
Copy link

I am using Microsoft hosted agents and checkout put the code into System.DefaultWorkingDirectory / so basePath configuration is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants