This writeup describes how to work with LFS on an internal / private gitlab server using self signed certificates.
Your git software (git cli command most likely) will need to have the git-lfs software installed. If you are on Ubuntu Linux, this add-on is available in the apt software repo, for example:
% sudo apt install git-lfs
By default, LFS should be enabled on your repository already. If it is not, any owner or maintainer of the GitLab repository should be able to turn it on through the GitLab web interface by:
- visiting the Settings menu for your project.
- from the Settings menu, go to: General -> Visibility, project features, permissions
- scroll down, you will see an option called: Git Large File Storage (LFS)
- enable it if necessary by clicking the toggle switch
This is pretty straightforward as the following example demonstrates:
cd existing-repo
git config http.sslVerify "false"
git lfs track "*.iso"
git lfs track "*.img"
git add .gitattributes
git commit -m 'Specify LFS file types'
git push origin main
I will explain why we set httpsslVerify to false shortly.
The commands above do the following:
- allow git LFS to work with a self signed certificate
- mark files ending in .iso and .img for LFS handling in a new file called .gitattributes
- we add the .gitattributes to our repo, commit, and push to main
Once you have a git repository on GitLab using a self signed certificate, you will need to make two slight changes to your behaviour when working with any repository that has LFS in use.
- When cloning the repository, you will need to clone like this:
GIT_SSL_NO_VERIFY="true" git clone gitlab:hw/bigstuff.git
- You need to set git's LOCAL scope configuration variable for the repository (just one time) like this:
git config http.sslVerify "false"
This allows SSL to work even though the certfificate we use inside is self-signed.