update 03-22 09:28
This commit is contained in:
39
push.sh
Normal file
39
push.sh
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
# 솔메카 Git Push - 신규/기존 프로젝트 동일하게 사용
|
||||
# 사용법: 프로젝트 폴더에서 push.sh
|
||||
|
||||
GITEA_HOST="100.125.85.86"
|
||||
GITEA_PORT="3000"
|
||||
GITEA_USER="downsys@naver.com"
|
||||
GITEA_PASS='@A9220fire!!'
|
||||
GITEA_ORG="choijaewook"
|
||||
SSH_KEY="$HOME/.ssh/id_ed25519"
|
||||
COOLIFY_USER="kakao"
|
||||
|
||||
NAME=$(basename "$(pwd)")
|
||||
REMOTE="http://${GITEA_HOST}:${GITEA_PORT}/${GITEA_ORG}/${NAME}.git"
|
||||
|
||||
echo -e "\033[0;36m[push] ${NAME}\033[0m"
|
||||
|
||||
# Git 초기화
|
||||
[ ! -d ".git" ] && git init -b main > /dev/null 2>&1 && echo " git init"
|
||||
|
||||
# Gitea 레포 없으면 생성
|
||||
ssh -o ConnectTimeout=5 -o LogLevel=ERROR -i "$SSH_KEY" "${COOLIFY_USER}@${GITEA_HOST}" \
|
||||
"curl -sf -u '${GITEA_USER}:${GITEA_PASS}' 'http://localhost:${GITEA_PORT}/api/v1/repos/${GITEA_ORG}/${NAME}'" > /dev/null 2>&1 \
|
||||
|| ssh -o ConnectTimeout=5 -o LogLevel=ERROR -i "$SSH_KEY" "${COOLIFY_USER}@${GITEA_HOST}" \
|
||||
"curl -sf -X POST -u '${GITEA_USER}:${GITEA_PASS}' -H 'Content-Type: application/json' \
|
||||
-d '{\"name\": \"${NAME}\", \"auto_init\": false}' \
|
||||
'http://localhost:${GITEA_PORT}/api/v1/user/repos'" > /dev/null 2>&1 \
|
||||
&& echo " 레포 생성: ${NAME}"
|
||||
|
||||
# Remote 설정
|
||||
git remote get-url origin > /dev/null 2>&1 || git remote add origin "$REMOTE"
|
||||
|
||||
# 커밋 + 푸시
|
||||
git add -A
|
||||
git commit -m "${1:-update $(date '+%m-%d %H:%M')}" > /dev/null 2>&1 || true
|
||||
git pull --rebase origin main > /dev/null 2>&1 || true
|
||||
git push -u origin main > /dev/null 2>&1 || git push -u origin main --force > /dev/null 2>&1
|
||||
|
||||
echo -e "\033[0;32m 완료: http://${GITEA_HOST}:${GITEA_PORT}/${GITEA_ORG}/${NAME}\033[0m"
|
||||
Reference in New Issue
Block a user