I'm trying to pip install a private repo via HTTPS in CI (GitHub Actions). It needs to be HTTPS because the org want to use authorised tokens to set permissions rather than ssh keys. I can do this with the following:
BASIC_CREDENTIAL=$(echo -n x-access-token:$repo_pat_token | base64 -)
git config --global http.https://github.com/.extraheader "Authorization: basic ${BASIC_CREDENTIAL}"
pip install <repo_a>[option] -e git+https://github.com/<org>/<repo_a>#egg=<repo_a>
And this works, unless repo_a has a dependency defined that's also a private repository (repo_b) installed by ssh, which in this organisation, is the case.
repo_a depends on several other private repos which are defined in a Poetry pyproject.toml, containing the following:
[tool.poetry.dependencies]
<repo_b> = {git = "ssh://git@github.com/<org>/<repo_b>", branch = "main"}
So the problem is: when I try to install repo_a, it tries to use ssh to install repo_b and fails:
Running command git clone -q https://github.com/<org>/<repo_a>
Running command git clone -q 'ssh://****@github.com/<org>/<repo_b>'
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
WARNING: Discarding git+ssh://****@github.com/<org>/<repo_b>@main. Command errored out with exit status 128: git clone -q 'ssh://****@github.com/<org>/<repo_b>' Check the logs for full command output.
I've tried using .insteadof (highlighted here) to no avail, same behaviour.
Note: I'm actually using Conda to install from an environment.yaml with pip dependencies, but I don't think Conda is the problem, as underneath it's pip running git clone commands.