9469d89a90
Step 1:
59 lines
1.6 KiB
Bash
59 lines
1.6 KiB
Bash
#!/bin/bash
|
|
|
|
# This script will initialize a Git repository and push your code to your Gitea server.
|
|
#
|
|
# HOW TO RUN THIS SCRIPT:
|
|
# 1. Open the Terminal in your development environment.
|
|
# 2. Type the following command and press Enter:
|
|
# bash push-to-gitea.sh
|
|
#
|
|
|
|
# Stop the script if any command fails
|
|
set -e
|
|
|
|
echo "Step 1: Initializing Git repository..."
|
|
# Check if a .git directory already exists
|
|
if [ -d ".git" ]; then
|
|
echo "Git repository already initialized."
|
|
else
|
|
git init -b main
|
|
echo "Repository initialized."
|
|
fi
|
|
|
|
echo "Step 2: Adding all files to the repository..."
|
|
git add .
|
|
echo "Files added."
|
|
|
|
echo "Step 3: Creating the first commit..."
|
|
# Only commit if there are changes to be committed.
|
|
if git diff-index --quiet HEAD --; then
|
|
echo "No changes to commit. Skipping commit."
|
|
else
|
|
git commit -m "Initial commit of EstimateFlow project"
|
|
echo "Initial commit created."
|
|
fi
|
|
|
|
|
|
echo "Step 4: Connecting to your Gitea server..."
|
|
# The URL for your Gitea repository
|
|
GITEA_URL="https://git.serfaty.co/admin/estimation-flow.git"
|
|
|
|
# Check if the 'origin' remote already exists
|
|
if git remote get-url origin > /dev/null 2>&1; then
|
|
echo "Remote 'origin' is already configured."
|
|
# Optional: update the URL in case it's wrong
|
|
git remote set-url origin $GITEA_URL
|
|
else
|
|
git remote add origin $GITEA_URL
|
|
echo "Remote 'origin' added."
|
|
fi
|
|
|
|
|
|
echo "Step 5: Pushing your code to Gitea..."
|
|
# The error was here. Your branch is called 'EstimateFlow', not 'main'.
|
|
git push -u origin EstimateFlow
|
|
|
|
echo ""
|
|
echo "✅ All done! Your code has been pushed to your Gitea repository."
|
|
echo "You can view it at: $GITEA_URL"
|