+28
-26
@@ -16,44 +16,46 @@ jobs:
|
||||
with:
|
||||
submodules: false
|
||||
|
||||
- name: Configure Git Auth
|
||||
- name: Setup Git Authentication
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
# Debug: Show current config before changes
|
||||
echo "Current git config:"
|
||||
git config --global --list || true
|
||||
# Create .netrc file (curl/wget style)
|
||||
echo "machine git.neru.rip" > ~/.netrc
|
||||
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"
|
||||
echo "https://${{ secrets.GITEA_TOKEN }}@git.neru.rip" > $HOME/.git-credentials
|
||||
|
||||
# Alternative: use URL rewrite with more precise matching
|
||||
git config --global url."https://${{ secrets.GITEA_TOKEN }}@git.neru.rip/".insteadOf "https://git.neru.rip/"
|
||||
# Set user info to avoid interactive prompts
|
||||
git config --global user.email "ci@example.com"
|
||||
git config --global user.name "CI Runner"
|
||||
|
||||
# Also try with http variant
|
||||
git config --global url."https://${{ secrets.GITEA_TOKEN }}@git.neru.rip/".insteadOf "http://git.neru.rip/"
|
||||
|
||||
# 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
|
||||
echo "Authentication configured"
|
||||
cat ~/.netrc
|
||||
|
||||
- name: Test Authentication
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
# Test if authentication works
|
||||
echo "Testing authentication to git.neru.rip..."
|
||||
git ls-remote https://git.neru.rip/neru/nerutils.git HEAD || true
|
||||
|
||||
|
||||
# Test with curl first
|
||||
echo "Testing with curl:"
|
||||
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
|
||||
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 update --init --recursive --force
|
||||
|
||||
|
||||
Reference in New Issue
Block a user