curl_github_ssh_port.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. # filepath: /Users/zhch158/workspace/repository.git/dots.ocr/zhch/test_copilot_connection.sh
  3. PROXY_PORT=7280
  4. echo "Testing GitHub Copilot connectivity..."
  5. # 测试基本的 GitHub API 访问
  6. echo "1. Testing GitHub API..."
  7. if curl -s --proxy http://localhost:$PROXY_PORT --connect-timeout 10 https://api.github.com/user > /dev/null; then
  8. echo "✓ GitHub API accessible"
  9. else
  10. echo "✗ GitHub API not accessible"
  11. fi
  12. # 测试 Copilot 特定的端点
  13. echo "2. Testing Copilot proxy service..."
  14. if curl -s --proxy http://localhost:$PROXY_PORT --connect-timeout 10 https://copilot-proxy.githubusercontent.com > /dev/null; then
  15. echo "✓ Copilot proxy service accessible"
  16. else
  17. echo "✗ Copilot proxy service not accessible"
  18. fi
  19. # 测试用户内容服务
  20. echo "3. Testing GitHub user content..."
  21. if curl -s --proxy http://localhost:$PROXY_PORT --connect-timeout 10 https://raw.githubusercontent.com > /dev/null; then
  22. echo "✓ GitHub user content accessible"
  23. else
  24. echo "✗ GitHub user content not accessible"
  25. fi
  26. echo "4. Testing with authentication (if token available)..."
  27. if [ ! -z "$GITHUB_TOKEN" ]; then
  28. if curl -s --proxy http://localhost:$PROXY_PORT -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/user > /dev/null; then
  29. echo "✓ GitHub authenticated API accessible"
  30. else
  31. echo "✗ GitHub authenticated API not accessible"
  32. fi
  33. else
  34. echo "ℹ GITHUB_TOKEN not set, skipping authenticated test"
  35. fi