gitea-create-repo/create.sh

18 lines
461 B
Bash
Raw Normal View History

2023-05-22 22:25:18 -07:00
#!/usr/bin/env bash
source .env
REPO_NAME=$(basename $(pwd))
GITEA_USERNAME=aynish
CREATE_REPO=true
2023-05-22 22:29:01 -07:00
curl -X 'POST' -H "Content-Type: application/json" -d "{ \"name\": \"${REPO_NAME}\"}" \
2023-05-22 22:25:18 -07:00
-H "Authorization: token ${GITEA_TOKEN}" \
2023-05-22 22:29:01 -07:00
"https://git.sealight.xyz/api/v1/user/repos"
2023-05-22 22:25:18 -07:00
if [ ${CREATE_REPO} ]; then
git init
git add .
git commit -m "Initial Commit"
2023-05-22 22:29:01 -07:00
git remote add origin "gitea@git.sealight.xyz:${GITEA_USERNAME}/${REPO_NAME}.git"
2023-05-22 22:25:18 -07:00
git push
fi