427f7a710c
- Configure git credentials at the beginning of init-repo.sh - Set up git user name/email with defaults or from environment variables - Create .git-credentials file with proper permissions (600) - Support multiple GitHub credential formats for better compatibility - Create symlinks to handle different credential file locations - Add test script to verify credentials configuration - Update documentation with new environment variables This fixes issues where containers fail due to missing .git-credentials by ensuring credentials are properly configured before any git operations. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
46 lines
1.3 KiB
Bash
Executable File
46 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# Test script to verify git credentials configuration
|
|
|
|
set -e
|
|
|
|
echo "=== Git Credentials Test ==="
|
|
|
|
# Check git configuration
|
|
echo "1. Git user configuration:"
|
|
git config --global user.name || echo " ❌ user.name not set"
|
|
git config --global user.email || echo " ❌ user.email not set"
|
|
|
|
echo ""
|
|
echo "2. Git credential helper:"
|
|
git config --global credential.helper || echo " ❌ credential.helper not set"
|
|
|
|
echo ""
|
|
echo "3. Credentials file locations:"
|
|
CREDENTIALS_FILE="/config/userdata/.git-credentials"
|
|
if [ -f "$CREDENTIALS_FILE" ]; then
|
|
echo " ✓ $CREDENTIALS_FILE exists"
|
|
echo " Permissions: $(stat -c %a $CREDENTIALS_FILE)"
|
|
echo " Lines in file: $(wc -l < $CREDENTIALS_FILE)"
|
|
else
|
|
echo " ❌ $CREDENTIALS_FILE does not exist"
|
|
fi
|
|
|
|
if [ -f "$HOME/.git-credentials" ]; then
|
|
if [ -L "$HOME/.git-credentials" ]; then
|
|
echo " ✓ $HOME/.git-credentials is a symlink to $(readlink -f $HOME/.git-credentials)"
|
|
else
|
|
echo " ✓ $HOME/.git-credentials exists (not a symlink)"
|
|
fi
|
|
else
|
|
echo " ❌ $HOME/.git-credentials does not exist"
|
|
fi
|
|
|
|
echo ""
|
|
echo "4. Environment check:"
|
|
echo " HOME=$HOME"
|
|
echo " GITHUB_TOKEN=${GITHUB_TOKEN:+[SET]}"
|
|
echo " GIT_USER_NAME=${GIT_USER_NAME:-[NOT SET]}"
|
|
echo " GIT_USER_EMAIL=${GIT_USER_EMAIL:-[NOT SET]}"
|
|
|
|
echo ""
|
|
echo "=== Test Complete ===" |