Skip to main content

Clone the Git repository

This tutorial uses the LND-With-Docker git repository: https://github.com/MegalithicBTC/LND-With-Docker

To proceed from here, you should be at least vaguely conversant with both Docker and Git.

Clone the git repository

Let's go into the mypool folder. If you don't have this folder, then you should go back to Set up a ZFS Pool.

myusername@ubuntu:~$ cd mypool

Let's make a workspace folder, a project folder, and connect that to GitHub.

mkdir workspace
cd workspace
sudo apt install git
git clone https://github.com/MegalithicBTC/LND-With-Docker

I also find it useful to tell Ubuntu to always navigate to the LND-With-Docker folder when a new terminal window is opened. This saves you having to navigate to the folder each time. You can do that with this one-liner:

echo -e "\ncd /mypool/workspace/LND-With-Docker" >> ~/.bashrc

Now, open your code editor, and point it to the LND-With-Docker folder.

Review the .gitignore file

I told you that you don't need to know a lot about Git, but there is one thing that it is CRITICAL that you understand.

In the root of the LND-With-Docker folder, you will find a .gitignore file.

You can also see it here: https://github.com/MegalithicBTC/LND-With-Docker/blob/master/.gitignore

With the various applications we will be running, we will be storing a lot of data on disk, and we want to make sure that the big files are excluded from this Git repository, and thus not uploaded to GitHub.

You will also see that with the directive **/PRIVATE/*, we tell git to ignore any files in any directory named PRIVATE. You will be storing some secret configuration data in these, and it's important that you keep this .gitignore file, in case you fork this repository and push it to your own version control.

If you're not experienced with .gitignore files

You'll see a lot of lines like this in the .gitignore

/tmp/*
!/tmp/.keep

This tricky syntax tells Git the following important things

/tmp/*: Don't upload any files in the tmp directory to Github

!/tmp/.keep: Make an exception to this rule for the .keep file

Why do we do this?

One of the many confusing and counter-intuitive things about Git is how it deals with empty folders.

If you make an empty folder, Git will ignore it. That will be a problem for us, because our repository comes with a LOT of empty folders, which we have because we need to put configuration secrets into them.

So: The way to get Git to upload a folder, but not its contents, is to tell it that it should upload one "dummy" file .. in this case, the .keep file.