- Open Package Center.
- Search for "Git Server".
- Click Install.
Alternatively, use the Git package from SynoCommunity.
- Go to Control Panel > Terminal & SNMP.
- Check Enable SSH service and set a port (default is 22).
- Click Apply.
- SSH to the NAS.
- Test the commands:
curl --version
ssh -V
git --version
- Navigate to [https://github.com/settings/personal-access-tokens]
- Select Generate new token
- Give your token a descriptive name (e.g., "NAS Mirror")
- Set an expiration date
- Select the level of access
- Add a Contents permission set to Read-only
- Click Generate token
- Copy the token immediately and store it securely (e.g., in a password manager)
cat > "$HOME/.env" << 'EOF'
GITHUB_USER=your_username
GITHUB_PAT=your_personal_access_token
EOF
chmod 600 "$HOME/.env"
chmod 755 "mirror-github.sh"
- Go to Control Panel > Task Scheduler > Create > Scheduled Task > User-defined script
- Give your task a descriptive name (e.g., "GitHub Mirror")
- Select an owner (the task will run as that user)
- Set the Run-command to
/bin/sh "$HOME/bin/mirror-github.sh" - Set schedule (e.g., daily)
- Decide if you want to receive emails when the script fails