In my ci.yml
, I have the following configuration:
- name: Configure Git Credentials
env:
GH_TOKEN: ${{ secrets.MKDOCS_MATERIALS_INSIDER_PAT }}
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git config url."https://${GH_TOKEN}@github.com/".insteadOf "[email protected]:"
git clone https://${GH_TOKEN}@github.com/heig-tin-info/mkdocs-material-insiders.git foo
git clone [email protected]:heig-tin-info/mkdocs-material-insiders.git bar
I expected the .insteadOf
configuration to automatically replace all [email protected]:
URLs with https://...
. In this example, the foo
clone works (demonstrating that my GH_TOKEN
is valid), but the bar
clone fails with the following error:
Cloning into 'bar'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have tried using the following values after .insteadOf
:
[email protected]:
[email protected]/
ssh://[email protected]/
My core problem is that I use Poetry, which requires the git
URL in my pyproject.toml
:
mkdocs-material = {git = "[email protected]:heig-tin-info/mkdocs-material-insiders.git"}
I do not want to change this configuration as it works for development. My private SSH key handles it perfectly. However, on the CI, I would expect the configuration to work transparently.
How should I configure my CI to allow fetching my private repositories using my GH_TOKEN
?