+26
-24
@@ -16,44 +16,46 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
submodules: false
|
submodules: false
|
||||||
|
|
||||||
- name: Configure Git Auth
|
- name: Setup Git Authentication
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
# Debug: Show current config before changes
|
# Create .netrc file (curl/wget style)
|
||||||
echo "Current git config:"
|
echo "machine git.neru.rip" > ~/.netrc
|
||||||
git config --global --list || true
|
echo "login oauth2" >> ~/.netrc
|
||||||
|
echo "password $GITEA_TOKEN" >> ~/.netrc
|
||||||
|
chmod 600 ~/.netrc
|
||||||
|
|
||||||
# Set up credential helper
|
# Also create git credential file
|
||||||
|
echo "https://oauth2:$GITEA_TOKEN@git.neru.rip" > ~/.git-credentials
|
||||||
|
|
||||||
|
# Configure git to use the credential file
|
||||||
git config --global credential.helper "store --file=$HOME/.git-credentials"
|
git config --global credential.helper "store --file=$HOME/.git-credentials"
|
||||||
echo "https://${{ secrets.GITEA_TOKEN }}@git.neru.rip" > $HOME/.git-credentials
|
|
||||||
|
|
||||||
# Alternative: use URL rewrite with more precise matching
|
# Set user info to avoid interactive prompts
|
||||||
git config --global url."https://${{ secrets.GITEA_TOKEN }}@git.neru.rip/".insteadOf "https://git.neru.rip/"
|
git config --global user.email "ci@example.com"
|
||||||
|
git config --global user.name "CI Runner"
|
||||||
|
|
||||||
# Also try with http variant
|
echo "Authentication configured"
|
||||||
git config --global url."https://${{ secrets.GITEA_TOKEN }}@git.neru.rip/".insteadOf "http://git.neru.rip/"
|
cat ~/.netrc
|
||||||
|
|
||||||
# Force git to use the credential store
|
|
||||||
git config --global credential.useHttpPath true
|
|
||||||
|
|
||||||
# Debug: Show config after changes
|
|
||||||
echo "Updated git config:"
|
|
||||||
git config --global --list | grep -i url || true
|
|
||||||
echo "Credential file:"
|
|
||||||
cat $HOME/.git-credentials || true
|
|
||||||
|
|
||||||
- name: Test Authentication
|
- name: Test Authentication
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
run: |
|
run: |
|
||||||
# Test if authentication works
|
# Test with curl first
|
||||||
echo "Testing authentication to git.neru.rip..."
|
echo "Testing with curl:"
|
||||||
git ls-remote https://git.neru.rip/neru/nerutils.git HEAD || true
|
curl -s -o /dev/null -w "HTTP Status: %{http_code}\n" https://git.neru.rip/neru/nerutils.git/info/refs?service=git-upload-pack || true
|
||||||
|
|
||||||
|
echo -e "\nTesting with git:"
|
||||||
|
# Use GIT_ASKPASS to provide empty password (since we're using .netrc)
|
||||||
|
GIT_ASKPASS=/bin/true git ls-remote https://git.neru.rip/neru/nerutils.git HEAD 2>&1 || true
|
||||||
|
|
||||||
- name: Fetch Submodules
|
- name: Fetch Submodules
|
||||||
run: |
|
run: |
|
||||||
|
# Set environment variables to force authentication
|
||||||
|
export GIT_ASKPASS=/bin/true
|
||||||
|
export GIT_TERMINAL_PROMPT=0
|
||||||
|
|
||||||
|
# Initialize submodules
|
||||||
git submodule sync --recursive
|
git submodule sync --recursive
|
||||||
git submodule update --init --recursive --force
|
git submodule update --init --recursive --force
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user