Git daemon Overview

In a version control system, the daemon is a very simple server for the Git repository. In technical terms, it is a simple TCP command that listens to port which is named as “Default Git Port”. It behaves just like normal servers where it waits for the connection to establish a service and serves if enabled.

The processing starts, and the daemon makes the repositories available to undergo git:// protocol, which seems insecure but is very efficient. When there is a security concern, you need to pull SSH protocol, and the default port that listens to it is 9418.

The configuration of the daemon is done by pushing without authentication. It is quite risky. It should always be performed under LAN enclosed environment, and the sources must be trustworthy. When in doubt, you should use the SSH to push securely.

The git daemon command verifies the directory with the magic file named as “git-magic-export-ok”. This will help Git to refuse the explicitly marked directory to export unless the parameter is set to all. Again, if you pass some directory paths specifying the parameters, you can further restrict them by comparing them from the whitelist that comes along with them.

Moreover, only upload-pack service is enabled by default which is used to serve packages like fetch-pack, ls-remote clients and are invoked using the clone, fetch or pull commands. This method is ideally used for read-only process and is undated from the archives in the server side itself.

Git daemon and its options

Let us now understand the other prospects of the daemon command in Git using various options.

Git daemon comes with tremendous functionalities. For the sake of our process and simplicity, it enables you to create your local server in the machine and you can easily collaborate, push directly and apply to clone. By adding different options with this command you can easily have your server act in different ways.

The daemon command invokes the following options as shown below:

Let’s breakdown the options as shown below:

The above option is used to point to the repository with the current directory using the dot sign. This is done to ensure the inclusion of file in the repository.

The above option is used to share all the available repositories from the base-path option.

This option is used to restart the allowed server from the old connection when time out occurs.

This option is primarily used to check the log details of all the oncoming connections requesting to join server.

This command is used to enable or disable the services across the whole network in the workspace per default.

The above option allows you to push anonymously.


Consider an instance where you need to share the GitHub repository but you don’t have access to it. In this case, you will use the git-daemon command which will enable you to access the repository for sharing. You will just need to define the methods of access. Let us take a look at some of the methods.

Read only access

This will run the daemon command and establish connection in the form of server. You may see something after this.

You can replace with your IP to address your local machine.

Push Access

This enables you to have push access across branches you want to push. It adds features you want to share and checkout. On further execution, it shows you something like this:

You need to create magic files as shown in the command below:

It will initially not be able to export. You need to define the –export-all options. After defining this, you will easily be able to share your single repository. It will output the following:

Now your client can easily access the repository.

Pin It on Pinterest

Share This