uv
uv copied to clipboard
uv add private GitHub repository with PAT on Actions fails
Summary
I'm Trying to setup a CI Workflow on GitHub Actions for a private repository that must pull another private repository. Using a Github PAT, I can make it work in pip but it fails with uv.
My CI.yml file is the following
...
jobs:
...
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
- name: Pip install packages
run: |
# using pip here would work, but uv fails
uv --verbose add "git+https://x-access-token:${TOKEN}@github.com/organization/private_repo"
uv sync
env:
TOKEN: ${{ secrets.GH_READONLY_PAT }}
where secrets.GH_READONLY_PAT is a PAT with read only access to private repos, which I tested and works correctly.
Running the action gives the following error
DEBUG No netrc file found
DEBUG GitHub API request failed for: https://api.github.com/repos/NeuralQXLab/netket_pro/commits/HEAD (404 Not Found)
DEBUG Fetching source distribution from Git: https://github.com/NeuralQXLab/netket_pro
DEBUG Acquired lock for `[https://github.com/neuralqxlab/netket_pro`](https://github.com/neuralqxlab/netket_pro%60)
DEBUG Updating Git source `[https://github.com/NeuralQXLab/netket_pro`](https://github.com/NeuralQXLab/netket_pro%60)
Updating https://github.com/NeuralQXLab/netket_pro (HEAD)
DEBUG Attempting GitHub fast path for: https://api.github.com/repos/NeuralQXLab/netket_pro/commits/HEAD
DEBUG Failed to check GitHub HTTP status client error (404 Not Found) for url (https://api.github.com/repos/NeuralQXLab/netket_pro/commits/HEAD)
DEBUG Performing a Git fetch for: https://github.com/NeuralQXLab/netket_pro
DEBUG Released lock at `/home/runner/actions-runner/_work/_temp/setup-uv-cache/git-v0/locks/d25fca3599406dfa`
DEBUG Reverting changes to `pyproject.toml`
DEBUG Removing `uv.lock`
× Failed to download and build `netket-pro @
│ git+[https://github.com/NeuralQXLab/netket_pro`](https://github.com/NeuralQXLab/netket_pro%60)
├─▶ Git operation failed
├─▶ failed to clone into:
│ /home/runner/actions-runner/_work/_temp/setup-uv-cache/git-v0/db/d25fca3599406dfa
╰─▶ process didn't exit successfully: `/usr/bin/git fetch --force
--update-head-ok 'https://github.com/NeuralQXLab/netket_pro'
'+HEAD:refs/remotes/origin/HEAD'` (exit status: 128)
--- stderr
fatal: could not read Username for 'https://github.com/': No such device
or address
I tried the following things:
- Execute the command above on my machine, with the same token, it works.
- Create a .netrc file in a preceding step with the token inside, but it is not used/does not solve the problem.
Most interestingly, by ssh-ing in the runner if the step fails, and running exactly the same command, the command success, so I have the feeling that if the session is interactive something different is triggered
Platform
linux GitHub runner
Version
0.5.29
Python version
3.12