Git Setup
Gitea
Server Config
Docker Shell with AuthorizedKeysCommand
Create custom shell
cat <<"EOF" | sudo tee /home/git/docker-shell
#!/bin/sh
/usr/bin/docker exec -i --env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" gitea sh "$@"
EOF
sudo chmod +x /home/git/docker-shell
sudo usermod -s /home/git/docker-shell git
Edit sshd configuration
cat <<"EOF" | sudo tee /etc/ssh/sshd_config.d/gitea.conf
Match User git
AuthorizedKeysCommandUser git
AuthorizedKeysCommand /usr/bin/docker exec -i gitea /usr/local/bin/gitea keys -c /data/gitea/conf/app.ini -e git -u %u -t %t -k %k
EOF
Runners
Actions
SSH Action Example
name: Rebuild Docs
run-name: ${{ gitea.actor }} is rebuilding the documentation
on: [push]
jobs:
Rebuild-Documentation:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" | tr -d '\r' > ~/.ssh/gitea.key
chmod 600 ~/.ssh/gitea.key
cat >>~/.ssh/config <<END
Host deploy
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/gitea.key
StrictHostKeyChecking no
END
cat ~/.ssh/config
env:
SSH_USER: root
SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_HOST: ${{ secrets.DOCS_HOST }}
- name: Run rebuild script over SSH
run: ssh deploy '/srv/smarthome_docs/update.sh'
Adding a new repo
TODO
Synology
TODO
Synology Knowledge Center - Git Server