fix: Simplify git clone to use token:@host format
This commit is contained in:
parent
f4346a799e
commit
b08ff7ad83
@ -200,24 +200,17 @@ jobs:
|
|||||||
mkdir -p "\$DEPLOY_DIR"
|
mkdir -p "\$DEPLOY_DIR"
|
||||||
cd "\$DEPLOY_DIR"
|
cd "\$DEPLOY_DIR"
|
||||||
|
|
||||||
# Configure git credentials
|
# Clone or pull latest code with token authentication
|
||||||
echo "Configuring git credentials..."
|
|
||||||
git config --global credential.helper store
|
|
||||||
echo "https://\${GITEA_TOKEN}:x-oauth-basic@git.silverlabs.uk" > ~/.git-credentials
|
|
||||||
|
|
||||||
# Clone or pull latest code
|
|
||||||
if [ ! -d .git ]; then
|
if [ ! -d .git ]; then
|
||||||
echo "Cloning repository with authentication..."
|
echo "Cloning repository with authentication..."
|
||||||
rm -rf * # Clean any existing files
|
rm -rf * # Clean any existing files
|
||||||
git clone https://git.silverlabs.uk/Jamie/littleshop.git .
|
# Use token as username, random string as password (Gitea format)
|
||||||
|
git clone https://\${GITEA_TOKEN}:@git.silverlabs.uk/Jamie/littleshop.git .
|
||||||
else
|
else
|
||||||
echo "Repository already cloned, pulling latest..."
|
echo "Repository already cloned, pulling latest..."
|
||||||
git fetch origin
|
git fetch origin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clean up credentials
|
|
||||||
rm -f ~/.git-credentials
|
|
||||||
|
|
||||||
echo "Checking out version: \$VERSION"
|
echo "Checking out version: \$VERSION"
|
||||||
git checkout \$VERSION || git checkout main
|
git checkout \$VERSION || git checkout main
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user