Howto – Install a Git integrated TFTP server


In a lot of technical environments there is the need for a Trivial File Transfer Protocol, or in short, TFTP server. TFTP is a simpel file transfer protocol that is readily used to boot systems over a network, or to upload or download configuration files from systems as routers, switches, firewalls, and so on …

The installation procedure of the below tftp server was performed on a Debian Stretch system with tftp-hpa as the daemon. The daemon would allow read and write operations. Subsequently, a Git script is installed as a systemd service to auto commit changes to a Git repository for history purposes. An instance of Gitlab was used as the Git server to store the Git repository.

TFTP Daemon Configuration

$ apt-get install -y tftpd-hpa
$ vi /etc/default/tftpd-hpa
# /etc/default/tftpd-hpa

TFTP_OPTIONS="--create --secure --blocksize 1468"

Install gitwatch and initialize git repository:

Gitwatch will make use of the inotify-tools package, which will notify the Gitwatch script when there is any file change.

$ sudo apt install -y git
$ sudo apt install -y inotify-tools
$ git clone
$ cd gitwatch/
$ sudo install -b /usr/local/bin/gitwatch
$ cd /srv/tftproot

First create a git repository in Gitlab, and note the url from your repository. Thereafter, create a Gitlab personal access token, this is required to access the repository later on.

$ git clone /srv/tftproot
$ git config --global credential.helper store /root/.git-credentials
# -- enter 'git' as username, and your token as the password
$ git pull

Install gitwatch as a service:

$ sudo vi /etc/systemd/system/gitwatch.service
Description=Watch file or directory and git commit all changes

ExecStart=/usr/local/bin/gitwatch -r origin -b master /srv/tftproot

$ sudo chmod 755 /etc/systemd/system/gitwatch.service
$ sudo systemctl daemon-reload
$ sudo systemctl enable gitwatch.service
$ sudo systemctl start gitwatch service

Published by

Ronny Van den Broeck

I'm a network and system engineer for more than 20 years now. During this period I became a pro in hunting down one's and zero's, with an eager mindset to help people accomplish the same or abstract them away from the matrix.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s