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

Unable to Clone another private repo from the same GitHub Organization #10

Closed
DominicCabral opened this issue Oct 13, 2018 · 7 comments
Closed

Comments

@DominicCabral
Copy link

I am currently running into an issue where I am able to pull from one private GitHub source in the checkout stage but unable to pull another private GitHub source from a script later in the pipeline due to lack of access rights. Note: Both Repos are a part of the same organization. And I've already connected the Azure App to GitHub with access to all Repos

Within my checkout stage I've explicitly set persistCredentials: true This, as I understand it, should allow the following scripts in the pipeline to use the GitHub credentials that were used in the checkout for "Get Sources".

Here is an example of the script that fails:

- script: |
git clone --branch=username --single-branch https://github.com/username/myRepo.git $(Agent.BuildDirectory)/myRepo
displayName: 'clone myRepo' 

And the output:

Generating script.
[command]/bin/bash --noprofile --norc /Users/vsts/agent/2.140.2/work/_temp/cb2622cc-28e0-435a-bb98-154bdabf9641.sh
Cloning into '/Users/vsts/agent/2.140.2/work/1/myRepo'...
fatal: could not read Username for 'https://github.com': Device not configured
##[error]Bash exited with code '128'
@astafan8
Copy link

I'm having a similar issue but it results in a different message.

I'm having a pipeline for SOME_PRIVATE_REPO that uses code from OTHER_PRIVATE_REPO within the same organization ORG. Azure Pipelines is enabled and is aware of both repositories (in settings in github).

Here's a snippet of the azure-pipelines.yml:

- script: |
      cd some_dir
      git clone https://github.com/ORG/OTHER_PRIVATE_REPO.git
      cd OTHER_PRIVATE_REPO
      git checkout v1
      pip install -e .
    displayName: 'Install OTHER_PRIVATE_REPO from tagged commit'

So, the job just hangs at the stage of Cloning into 'OTHER_PRIVATE_REPO'..., and after some time gets automatically cancelled due to timeout.

I tried googling but couldn't find how to access other private github repo inside a pipeline for a private github repo. Does anybody know?

@astafan8
Copy link

I've found a solution that I don't like but it works.

In the pipelines editor on azure devops, go to variables section, and create a secret variable with a github access token in it. Then, refer to it in the git clone command in the azure-pipelines.yml file.

Resulting snippet from my yml file:

- script: |
      cd some_dir
      git clone https://x-access-token:$(astafan8-github-access-token)@github.com/ORG/OTHER_PRIVATE_REPO.git
      cd OTHER_PRIVATE_REPO
      git checkout v1
      pip install -e .
    displayName: 'Install OTHER_PRIVATE_REPO from tagged commit'

The x-access-token part was found here.

@rauljmz
Copy link

rauljmz commented Dec 17, 2018

Having the exact same issue. I agree with @astafan8 - I don't like the solution with the secret and the access token. Ideally it should support multiple the build pipeline should support checkout tasks. I think it relates to this User Voice request

@Adnn
Copy link

Adnn commented Jan 20, 2020

Any progress on this front?

@stale
Copy link

stale bot commented Apr 25, 2020

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.

@stale stale bot closed this as completed Apr 26, 2020
@Saibamen
Copy link

Moved into Developer Community: https://developercommunity.visualstudio.com/content/problem/1007491/unable-to-clone-another-private-repo-from-the-same.html
Please use "Follow" button on the right to track it

@Saibamen
Copy link

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

No branches or pull requests

5 participants