Initial Commit
This commit is contained in:
commit
5415d10f56
2
.env
Normal file
2
.env
Normal file
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env bash
|
||||
export GITEA_TOKEN=f32cb554ac3aed90754d62d476043cebcfad272f
|
25
README.rst
Normal file
25
README.rst
Normal file
|
@ -0,0 +1,25 @@
|
|||
___ __ ____ ____ __ ____ ____ ____ __ ___ ____ ____ __ ____ __ ____
|
||||
/ __)( )(_ _)( __) / _\ ( _ \( __)( _ \ / \ / __)( _ \( __) / _\(_ _)/ \( _ \
|
||||
( (_ \ )( )( ) _) / \ ) / ) _) ) __/( O ) ( (__ ) / ) _) / \ )( ( O )) /
|
||||
\___/(__) (__) (____)\_/\_/ (__\_)(____)(__) \__/ \___)(__\_)(____)\_/\_/(__) \__/(__\_)
|
||||
|
||||
===============================================================================================
|
||||
|
||||
A simple bash command to create a gitea repository.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
* bash
|
||||
* curl
|
||||
* gitea user account and token
|
||||
|
||||
Instructions
|
||||
------------
|
||||
|
||||
First you must create a token that the application can use. This can be created on your user settings page in Gitea. (Maybe I'll write another script here that can create one for you from you password?)
|
||||
|
||||
Once the token has been created, copy the `env.sample` file to `.env` and place your token into the exported environment variable.
|
||||
Now you can create a symbolic link to the create script to some folder that is included in your `PATH` (either `/usr/local/bin` or `~/.local/bin` are generally supported, but it depends on the distribution)
|
||||
|
||||
This script also initializes the git repo, adds everything currently in your directory and commits it to git. This can be changed via `CREATE_REPO`
|
17
create.sh
Executable file
17
create.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
source .env
|
||||
REPO_NAME=$(basename $(pwd))
|
||||
GITEA_USERNAME=aynish
|
||||
CREATE_REPO=true
|
||||
|
||||
curl -X POST -H "Content-Type: application/json" -d "{ \"name\": \"${REPO_NAME}\"}" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"https://git.sealight.xyz/api/v1/user/repo"
|
||||
|
||||
if [ ${CREATE_REPO} ]; then
|
||||
git init
|
||||
git add .
|
||||
git commit -m "Initial Commit"
|
||||
git remote add "gitea@git.sealight.xyz:${GITEA_USERNAME}/${REPO_NAME}.git"
|
||||
git push
|
||||
fi
|
5
env.sample
Normal file
5
env.sample
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
# Either copy this file, or create a new one with your password
|
||||
# Rename the new file to .env
|
||||
# DON'T PLACE IN GIT REPO
|
||||
export GITEA_TOKEN=your-password-here
|
Loading…
Reference in a new issue