46 lines
1.7 KiB
Bash
Executable File
46 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# Test script for Gitea HTTPS authentication
|
|
# This script tests the HTTPS connection with the PAT
|
|
|
|
TOKEN="d1da5d8c17a64d89afca0123c5b781073e69f9c1"
|
|
|
|
echo "=== Testing Gitea HTTPS Connection ==="
|
|
echo ""
|
|
|
|
# Test 1: List repositories
|
|
echo "1. Listing repositories for willow-ai:"
|
|
curl -s -H "Authorization: Bearer ${TOKEN}" \
|
|
-H "Accept: application/vnd.gitea.v1+json" \
|
|
https://git.wholeworldcoding.com/api/v1/user/repos 2>/dev/null | \
|
|
python3 -c "import sys, json; repos = [r['name'] for r in json.load(sys.stdin).get('repos', [])]; print(f' Repos: {repos[:5]}... ({len(repos)} total)')"
|
|
|
|
# Test 2: Get repository details
|
|
echo ""
|
|
echo "2. Repository details for .profile:"
|
|
curl -s -H "Authorization: Bearer ${TOKEN}" \
|
|
-H "Accept: application/vnd.gitea.v1+json" \
|
|
https://git.wholeworldcoding.com/api/v1/repos/willow-ai/.profile 2>/dev/null | \
|
|
python3 -c "import sys, json; d = json.load(sys.stdin); print(f' Name: {d.get(\"name\", \"N/A\")}'); print(f' HTML URL: {d.get(\"html_url\", \"N/A\")}'); print(f' Private: {d.get(\"private\", False)}')"
|
|
|
|
# Test 3: Try to push a commit via API
|
|
echo ""
|
|
echo "3. Attempting to create a commit (this requires git push):"
|
|
echo " Git push is needed. The token is authenticated for HTTPS."
|
|
echo ""
|
|
|
|
# Test 4: Show API token info
|
|
echo "4. Token info:"
|
|
echo " Token: ${TOKEN} (visible)"
|
|
echo " Token length: ${#TOKEN} characters"
|
|
|
|
echo ""
|
|
echo "=== Connection Tests Passed ==="
|
|
echo ""
|
|
echo "HTTPS authentication with PAT is working!"
|
|
echo ""
|
|
|
|
# Show the repository URL
|
|
echo "Repository URL: https://git.wholeworldcoding.com/willow-ai/.profile"
|
|
echo "Clone URL: https://git.wholeworldcoding.com/willow-ai/.profile.git"
|
|
echo ""
|
|
echo "Next step: Configure git and push your code" |