Refactor README for clarity and remove obsolete push script
This commit is contained in:
parent
56246a9484
commit
dbdac9f78f
@ -1,57 +0,0 @@
|
|||||||
Push the current workspace to a remote Git repository
|
|
||||||
|
|
||||||
This repository contains helper files to push the current code to a remote git server (example: https://git.algios.dev/francescoalbano/tripweb.git).
|
|
||||||
|
|
||||||
Important: I (the assistant) cannot run git push from here. Run the following commands locally on your machine where you have your SSH keys / credentials configured.
|
|
||||||
|
|
||||||
Quick commands
|
|
||||||
|
|
||||||
1) Verify you are on the correct branch and that working tree is clean:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git status
|
|
||||||
# commit any changes
|
|
||||||
git add -A
|
|
||||||
git commit -m "Prepare repo for remote" # if needed
|
|
||||||
```
|
|
||||||
|
|
||||||
2) Add remote and push (automatic):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# make script executable
|
|
||||||
chmod +x scripts/push-to-remote.sh
|
|
||||||
# run the script — it defaults to the repo you provided
|
|
||||||
./scripts/push-to-remote.sh https://git.algios.dev/francescoalbano/tripweb.git main
|
|
||||||
```
|
|
||||||
|
|
||||||
If you prefer manual commands:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# add remote (if not present)
|
|
||||||
git remote add origin https://git.algios.dev/francescoalbano/tripweb.git
|
|
||||||
# set branch name (main assumed)
|
|
||||||
git branch -M main
|
|
||||||
# push
|
|
||||||
git push -u origin main
|
|
||||||
```
|
|
||||||
|
|
||||||
If your remote expects SSH, use the SSH URL instead:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# example
|
|
||||||
git remote add origin git@git.algios.dev:francescoalbano/tripweb.git
|
|
||||||
git push -u origin main
|
|
||||||
```
|
|
||||||
|
|
||||||
Troubleshooting
|
|
||||||
|
|
||||||
- Permission denied / authentication: ensure your SSH key or username/password is configured for the remote server. Prefer SSH keys.
|
|
||||||
- Repo doesn't exist: create an empty repo on the remote first (on git.algios.dev web UI) and then push.
|
|
||||||
- Non-fast-forward errors: if the remote already has commits, consider pulling first or force push only if you understand the risks.
|
|
||||||
|
|
||||||
Next steps I can do for you
|
|
||||||
|
|
||||||
- Create a GitHub Actions workflow to build frontend and/or backend and push images/artifacts to the remote registry.
|
|
||||||
- Create `docker-compose.prod.yml` and deployment SSH Actions that deploy to your Proxmox host.
|
|
||||||
|
|
||||||
Tell me which of the above you want me to generate next.
|
|
||||||
@ -1,66 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# push-to-remote.sh
|
|
||||||
# Usage: ./scripts/push-to-remote.sh [remote_url] [branch]
|
|
||||||
# If remote exists it will be used; otherwise added as 'origin'.
|
|
||||||
|
|
||||||
REMOTE_URL=${1:-https://git.algios.dev/francescoalbano/tripweb.git}
|
|
||||||
BRANCH=${2:-main}
|
|
||||||
|
|
||||||
print() { echo "[push-to-remote] $*"; }
|
|
||||||
|
|
||||||
# Ensure git repo
|
|
||||||
if [ ! -d .git ]; then
|
|
||||||
print "No .git found in current directory. Initialize and commit? (y/n)"
|
|
||||||
read -r yn
|
|
||||||
if [ "${yn,,}" != "y" ]; then
|
|
||||||
print "Aborting."; exit 1
|
|
||||||
fi
|
|
||||||
git init
|
|
||||||
git add .
|
|
||||||
git commit -m "Initial commit"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Ensure working tree clean
|
|
||||||
if [ -n "$(git status --porcelain)" ]; then
|
|
||||||
print "Working tree is not clean. Please commit or stash changes first.";
|
|
||||||
git status --porcelain
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add remote if missing
|
|
||||||
if git remote get-url origin >/dev/null 2>&1; then
|
|
||||||
CURRENT_URL=$(git remote get-url origin)
|
|
||||||
if [ "$CURRENT_URL" != "$REMOTE_URL" ]; then
|
|
||||||
print "Remote 'origin' exists and points to $CURRENT_URL"
|
|
||||||
print "Do you want to set origin to $REMOTE_URL ? (y/n)"
|
|
||||||
read -r yn
|
|
||||||
if [ "${yn,,}" = "y" ]; then
|
|
||||||
git remote remove origin
|
|
||||||
git remote add origin "$REMOTE_URL"
|
|
||||||
else
|
|
||||||
print "Keeping existing origin. Aborting."; exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
print "Remote 'origin' already set to $REMOTE_URL"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
git remote add origin "$REMOTE_URL"
|
|
||||||
print "Added origin -> $REMOTE_URL"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Ensure branch exists locally
|
|
||||||
if git rev-parse --verify "$BRANCH" >/dev/null 2>&1; then
|
|
||||||
git checkout "$BRANCH"
|
|
||||||
else
|
|
||||||
git checkout -b "$BRANCH"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Push
|
|
||||||
print "Pushing to origin/$BRANCH..."
|
|
||||||
# Use upstream set on first push
|
|
||||||
git push -u origin "$BRANCH"
|
|
||||||
print "Push complete. If this was the first push, create the repo on remote or ensure you have permission and the repo exists."
|
|
||||||
|
|
||||||
# End
|
|
||||||
Loading…
x
Reference in New Issue
Block a user