Comments (27)
Ran into the same issue. Docs definitely misleading.
from azure-pipelines-yaml.
For completeness and @ngnkm if you still have issues, the workaround is correct but:
- the command can be simplified into
git -c http.extraheader=... clone -b master
since the extra header will apply only to the current command so no need to specify a particular remote host - you can also use the extraheader
Authorization: Basic <token>
and generate the token based on a username and a personal access token (PAT), for example with the PowerShell command:This has the advantage of working with a GitHub repository. You can generate a PAT in your GitHub account settings.$Authorization = "Authorization: Basic " + [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes('$(User):$(PAT)')) git clone -c http.extraheader="$Authorization" -b master $(RepoURL) $(Build.SourcesDirectory)/extra_repo
from azure-pipelines-yaml.
I was running into similar issues trying to use ARM templates from a different repo in my multistage yaml pipeline.
I managed to clone the dependent repo using the header info from the repo you are currently using.
- checkout: self
clean: true
persistCredentials: true
- powershell: |
$origin = git config remote."origin".url
$extraheader = git config http.$origin.extraheader
git clone -c http.extraheader="$extraheader" --depth 1 --branch ${{ parameters.branch }} ${{ parameters.repo }}
displayName: Git clone
workingDirectory: $(Build.SourcesDirectory)
Edit: Updated the example to be more generic
from azure-pipelines-yaml.
@ngnkm Nope this checkout
step from azure-pipelines for an external repo doesn't work and their documentation is clearly messed up. Instead I ended up doing a manual git clone
step through a shell script.
from azure-pipelines-yaml.
The "self" option on the checkout's task permits to checkout the repo where the initial Pipelines YAML file was found.
You currently can't replace this option with the name of your repo.
At the time speaking if you want to checkout your github repo with the "checkout" task you need to move your YAML file on your github repo.
Multi-repository support for YAML pipelines is planned for Q3 2019 in Azure DevOps roadmap and this might solve your issue, stay tunned : Azure DevOps Roadmap Q3 - ITEM 1454026
from azure-pipelines-yaml.
The recent DevOps rollout has this multi checkout natively supported now and docs seemed updated...so I think this can be closed
however if u came here looking for some secret sauce like me for something like tricking terraform to use the pipelines creds when importing modules from other DevOps repos in your project the secret is in this thread...kinda. The hint about PATs is good for non DevOps repos but if you are in DevOps repos there’s an easier command from
https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/azure-repos-git?view=azure-devops&tabs=yaml#authorize-access-to-your-repositories
‘git clone -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" ’
So the secret is that variable pipelines injects no need to generate it yourself. I passed that to terraform (via global git config trickery)
from azure-pipelines-yaml.
I have a Terraform project that includes another module in a private github repository and terraform init
fails due to me needing to use a Github PAT. Do I still have to do this? If so, why?
- checkout: self
clean: true
persistCredentials: true
- task: Bash@3
name: Add_Git_Credentials_to_Global_ExtraHeader_Config
displayName: Add Git Credentials to http.extraheader
inputs:
targetType: inline
script: |
origin=$(git config remote.origin.url)
origin=${origin%.git}
git config http.extraheader "$(git config http.${origin}.extraheader)"
from azure-pipelines-yaml.
Hello.
Did you get a solution about this error?
Please let me know if that is the case.
Thanks
from azure-pipelines-yaml.
thanks for your response. Now I'm trying to clone my repo via a git clone command but the authorization failed. How did you configure it? I used this command but it's doesn't work. git -c http.https:*******/_git/*****.extraheader="AUTHORIZATION: bearer *******" clone https:*****/_git/**** --branch master
from azure-pipelines-yaml.
Bump - Is there any plan/timeline to support this feature? This would be much easier than doing some manual git clone with custom PAT-based authorization, which is always tricky to get right and safe. Also the documentation should be updated to not advertise the feature if it is not implemented.
from azure-pipelines-yaml.
Thanks @JamesDLD. In that case can you please fix the Azure Pipeline YAML documentation which currently suggests this feature is already implemented, as noted by @samiyaakhtar?
from azure-pipelines-yaml.
Indeed the doc highlighted by @samiyaakhtar here on GitHub shows that we can use other parameters that "none" or "self" in the "checkout" task..
This is probably being released, hopefully!
Note that I am not working at Microsoft about your ask about updating MS doc.
At the time writting the official documentation indicates only two options :
from azure-pipelines-yaml.
Ok sorry @JamesDLD I didn't check you profile.
The docs points by @samiyaakhtar is the master
branch, maybe we're too early and the feature is being rolled out but didn't make it to prod yet. That would be consistent with the roadmap you linked.
from azure-pipelines-yaml.
same issues here, not sure the document says about and even give instruction on features that are not there.
from azure-pipelines-yaml.
Yes but this is very annoying and error prone. Your case is quite simple @michaelw85, so your solution works here. But things get complicated fast when cloning repositories with submodules for example, or when trying to optimize checkout of a particular commit for large repos like the built-in checkout does. Also some hosts like GitHub don't support checking out random commits, only refs, so you need a more complex series of commands.
Also incidentally git commands output to stderr
, which powershell assumes are errors, so you should make sure to handle that to avoid spurious failures. See again the built-in checkout. There is a flag failOnStderr
on the powershell task, but it doesn't work for me. So I ended up wrapping all my git commands with a PS function call capturing stderr
and checking the exit code instead for errors. My checkout script is now 50 lines or so.
All of that to say, this could be handled by the built-in checkout, probably should for the sake of users, and hopefully will be soon as @JamesDLD pointed.
from azure-pipelines-yaml.
I just found that doc which very clearly says this is supported and details the steps to configure multiple repositories. I am assuming this is not rolled out yet?
from azure-pipelines-yaml.
I can't even do checkout:self, i get ""Checkout of multiple repositories is not supported."
Troubleshoot".
I think priority for this work item should be increased, checking out multiple repos is a must.
UPDATE:
I figured out it was because the checkout:self cannot appear multiple times. Error message is misleading, because it's not multiple repos, but multiple times the same repo.
from azure-pipelines-yaml.
Looks like this feature is still in development for Q4, but I found some more official documentation for a workaround if anyone is still struggling with this before the release comes
https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/pipeline-options-for-git?view=azure-devops#clone-a-second-repo
from azure-pipelines-yaml.
The recent DevOps rollout has this multi checkout natively supported now and docs seemed updated...so I think this can be closed
Not working on my devops org yet.
Getting error:
Checkout of repository 'otherRepo' is not supported. Only 'self', 'none', or a repository alias are supported.
from azure-pipelines-yaml.
The recent DevOps rollout has this multi checkout natively supported now and docs seemed updated...so I think this can be closed
Not working on my devops org yet.
Getting error:
Checkout of repository 'otherRepo' is not supported. Only 'self', 'none', or a repository alias are supported.
U setup that alias in the resources section per the docs?
from azure-pipelines-yaml.
The recent DevOps rollout has this multi checkout natively supported now and docs seemed updated...so I think this can be closed
Not working on my devops org yet.
Getting error:
Checkout of repository 'otherRepo' is not supported. Only 'self', 'none', or a repository alias are supported.U setup that alias in the resources section per the docs?
Found the issue. Doesn't work in deployment job. Will be fixed in 3 week in next rollout as per this issue item:
https://github.com/MicrosoftDocs/vsts-docs/issues/6683
from azure-pipelines-yaml.
The checkout: self works fine but a checkout: myrepo , defined in a resources: list fails with fatal: repository 'myrepo...' not found
The url shown in line 20 is correct and works with a manual git clone etc
from azure-pipelines-yaml.
In order to consolidate to fewer feedback channels, we've moved suggestions and issue reporting to Developer Community. Sorry for any confusion resulting from this move.
from azure-pipelines-yaml.
Moved into Developer Community: https://developercommunity.visualstudio.com/content/problem/1007479/unable-to-checkout-external-repo.html
Please use "Follow" button on the right to track it
from azure-pipelines-yaml.
@samiyaakhtar: Please go to this link and check if this issue is still happen: https://developercommunity.visualstudio.com/content/problem/1007479/unable-to-checkout-external-repo.html
from azure-pipelines-yaml.
@Saibamen seems to be working now, thanks!
from azure-pipelines-yaml.
Getting this error now. Is it a versioning issue?
from azure-pipelines-yaml.
Related Issues (20)
- how to triger a build pipeline from powershell HOT 2
- Pipeline resource trigger documentation missing prerequisite HOT 1
- could find the branch error in azure yaml HOT 2
- python task ran successfull but pipeline is faiing with bash exit code 1 HOT 3
- Azure YAML Pipelines - Using template expression variables at non-global scope HOT 1
- Examples for resource pipeline and source inputs are not clear. HOT 9
- Hi Team While running my Azure pipeline.yaml I am getting following error: directive are not supported for the expression that are embedded within the string Directive are only supported when the entire value is an expression HOT 1
- This repo is missing important files
- It is possible to convert a json to variables/parameters YAML and iterate? HOT 3
- Support for conditions in templates? HOT 1
- Custom expression/function in Yaml HOT 1
- Azure DevOps YAML Template Powershell script file issue HOT 2
- Azure Pipelines Resource Trigger (branch filter) not working as expected. HOT 2
- GitHub Actions Build Error: Invalid App Path for Django-Celery-Beat Dockerfile HOT 3
- Error running pipeline after renaming default GitHub branch from 'master' to 'main' HOT 3
- Publishing artifacts from a failed step HOT 1
- Pass variables from Build pipeline to Release HOT 2
- Error signing debug variant bundle android app using YAML file HOT 2
- Cannot submit IPA file to AppStore when AppStore requires iOS 17 SDK or later HOT 1
- Enable 'repository.name' for accepting variables HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-pipelines-yaml.