Internal Repository Not Reachable From Actions

I have a trio of internal repositories in my organization.

In the package.json of Repository A is a dependency on the contents of Repository B.  Repository C is just like B.

When I run yarn or npm locally, I have no problems with the installation of the dependencies.

However when I trigger a workflow that is intended to install dependencies then do a build, the process fails.

The output looks like this:

yarn install v1.22.0
[1/4] Resolving packages...
error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads ***github.com/<myorg>/<RepositoryB>.git
Directory: /github/workspace
Output:
remote: Repository not found.
fatal: repository 'https://github.com/<myorg>/<RepositoryB>.git/' not found
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

I have tried several approaches to fixing this including using a PAT with Secrets on Repository A. That PAT was given all permissions except for creating GPG keys, and Org Admin.  I have also tried using SSH Key and putting the private key in Repository A Secrets and the deploy key in Repository B.

This seems like a big missing feature of Actions if there is no way to accomplish.

Hey! Can you show the command that you are calling that gives the error? GitHub, in general, supports the ability to use a private repo as a dependency of another private repo so I think the culprit is the command itself. 

2 Likes
- name: Install Dependencies
              uses: <myorg>/<myrepo>/.github/actions-yarn@master
              with:
                  cmd: install

This is the command that fails.  I have tried the setup-node action as well.
Inside my package.json file there are dependencies using OAUTH:

"eslint-config": "git+https://<OAUTH_TOKEN>:x-oauth-basic@github.com/<myorg>/<myrepo>.git"

OAUTH_TOKEN is not a replace key in our system yet, so it’s right in there.  This works on development machines.
Our org uses Single Sign On (SSO) as well if that’s a factor.

Hi @elihuntington ,

I can reproduce the same with below code:

steps:
      - name: checkout
        uses: actions/checkout@v2

      - name: gitremote
        run: |
          git ls-remote --tags --heads https://github.com/weide-zhou/ticket1.git

giterror.png

Did you use ‘actions/checkout@v2’ at prior step as well? ‘actions/checkout@v2’ will persist the GITHUB_TOKEN credential to the repo config to make git operations. Please use ‘actions/checkout@v1’ instead. Or if you use v2, please add ‘persist-credentials: false’ in the action args. Please check the link for more details.

If the issue still persists, please share a repo sample or total yaml to help further investigation.

Thanks.

1 Like

This did fix it for me!  Since I am in a private org, I had to clone the checkout/v1 action into my .github folder.
I put Personal Access Token in GitHub Secrets and everything started working!  Thanks for your help.

yarn install v1.22.0
[1/4] Resolving packages...
error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads ***github.com/<myorg>/<RepositoryB>.git
Directory: /github/workspace
Output:
remote: Repository not found.
fatal: repository 'https://github.com/<myorg>/<RepositoryB>.git/' not found
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.