Friday, October 30, 2026

Git and .gitignore

I posted a few days ago that I'd deployed Gitea (a git server).

I basically pushed my /opt/stacks directory to Gitea.

Well, I'm now finding that I pushed non-IaC files to my repos, and I'm only supposed to push IaC files (e.g., compose.yml files or any config files that I normally create/manipulate).  I discovered that many files were either plugins or gz files, for example...neither of those are IaC filetypes.  

Additionally, I realized that I should not push .env files (or any files that contain secrets/passwords) to Git.

I was not aware that I could filter out files/directories, nor was I aware of .gitignore until I researched how to exclude files.  

I also created .gitignore files within each stack, which, later on, I found wasn't optimal.  Instead of having a separate ignore file for each stack (e.g., /opt/stacks/wordpress and /opt/stacks/dockge), the more efficient method would be to place the ignore file at /opt/stacks, so I ended up redoing all of my repos.

A .gitignore file is just a hidden file to exclude files from being pushed to Gitea (or whatever Git solution you're using).

For example, my .gitignore contents on my hosted public server is:

# --- General Backups, Archives & Logs ---
*.tar.gz
*.gz
*.zip
*.bak
*.bak.*
*.old
*.10*
*.log
# --- App Data & Databases ---
**/data/
**/portainer-data/
pihole/etc-pihole/
pihole-old/etc-pihole/
# --- WordPress Core, Backups & Bloat ---
wordpress/wp-admin/
wordpress/wp-includes/
wordpress/*.php
!wordpress/wp-config-sample.php
!wordpress/.htaccess
!wordpress/index.php
wordpress/*.txt
wordpress/*.html
# --- WordPress Content / Plugins / Backups / Logs ---
wordpress/wp-content/uploads/
wordpress/wp-content/cache/
wordpress/wp-content/upgrade/
wordpress/wp-content/plugins/
wordpress/wp-content/themes/
wordpress/wp-content/bps-backup/
wordpress/wp-content/updraft/
wordpress/wp-content/wflogs/
wordpress/wp-content/wpo-cache/
# --- System & Temp Files ---
.DS_Store
.env

As I learn Git, I find that it can be very satisfying to track/truth my IaC files.

I've not yet used Git at work, although I've an account - I typically do not use IaC content for the work I'm currently doing, but I'm sure I'll eventually use IaC content to streamline my work.  The main concern for me is to learn best practices for IaC and Git.  I'm just hoping I'm not teaching myself bad habits now, to have to correct myself later on - definitely don't want mistakes to happen at work, either, which is why I'm practicing at home.

UPDATE (10/31/2026):  A day after I posted this, I see a Reddit post with good info on .gitignore best practices (in the comment thread, not the original post).  Here it is.

Wednesday, October 21, 2026

If Your're Using PHP On An Exposed Host, Beware!

If you're running Wordpress or ANYTHING that uses PHP, there are two critical vulnerabilities with exploits in the wild right now.

You should ensure that you're not using anything outside of what's recommended in the PHP advisory I mentioned above.  New (fixed) versions of PHP were released today, so those can be applied as fixes.

In my case, I'm running a containerized Wordpress.  I waited all day for the Docker images to be released that fixes the issues.  I'm using Alpine images and thought that I could just install Alpine PHP packages, but the Docker images were available before the new Alpine PHP packages were released.  My site is repaired of those two particular vulnerabilities.

We'll see how many websites get compromised over the next few months because folks ignored the warnings.

Thursday, October 15, 2026

I've Backed Up My OneNote Notes to Markdown!

I wanted to try to back up my OneNote notebooks, as I've been using it a long while now.  Even though I'm using it with Microsoft's OneDrive (cloud-based), I feel that it's always good to have backups.

The plan was to back up the files to Markdown format and then store them in my private Gitea (Git) server.

It took a bit to understand what I needed to do.

I used Obsidian to synch up with OneNote to import the notebooks and then convert them to Markdown format.  There were close to 400 pages between 4 notebooks.  It took a few minutes for Obsidian to do it's thing but it ALMOST finished.  OneNote started rate-limiting Obsidian at the 90% completion mark.  I stopped the import process and waited 15 minutes before trying again.  

There's a feature that you can enable that skips files that have already been processed, so it basically started at the 90% mark and fininshed.  This means that I can continue to document in OneNote and periodically back up the files, where only the new notes and images are backed up.  Obsidian is pretty nice - it has allowances for a bunch of other file types and can import/backup other software files, as well.

Monday, October 12, 2026

I Now Have A Functional (and Private) Git Server

I've been struggling with wrapping my head around Git the past 4-5 years.  It sounds silly, yeah, but I'm old school.  

I started my first position in the IT Security field in 2003.  There was no such thing as Infrastructure as Code (IaC).  The first time I remember hearing of IaC was in 2017.  Note that I didn't enter the sub-field of security engineering in a dedicated fashion up until 2017.  In my prior positions, I didn't need to be familiar with such information.

I didn't even start being involved with Docker up until 5 years ago.  I was initially pushed to it by work - my supervisor wanted each team to be familiar with it, so I tool an ACloudGuru course.  I didn't use it at work after finishing the course (and the course didn't cover Git), either, but I got some ideas on how to use it at home (in the home lab).  

I wanted to use Docker containers to replace a lot of my old computers within my lab, but actually ended up using it to install Wordpress on a Docker instance, hoping to replace my Wodrpress website with a dockerized instance.  I intially set up Wordpress on my LAN as a container stack.  When I saw how easy it was to set up, and after I tested and ran it maybe 6 months on my LAN, I replaced the server instance with a docker instance on the hosted server (Linode).  It was super easy and I think it runs more efficiently.  I just restored a good known backup onto the Dockerized Wordpress.

At this point, I've tested several containerized Wordpress setups, seeking greater efficiency, so there were tons of compose files that I wasn't tracking because I kept avoiding Git (and couldn't even understand it).

Only tonight, after speaking with a coworker about it, after gaining understanding of it when researching it (and Terraform usage), and after asking Gemini AI questions, I was able to give it a shot.

For Git, I'm using a Gitea as a container.  I used Gemini to ask questions on how to set up a private Git that I could keep track of all my code (across 3 different Docker host systems, on the LAN and from a public server, as well).

For each Docker host, I've created a repo to track that host's Docker code.  It took a long while to understand that I had to push the IaC files to the Gitea server.  I initially didn't even have an idea of how to map out the repos.  I was a total mess.

Now that I've the repos set up, I do not want to have to set it all up again, but if I had to, it would probably go a lot quicker in setting things up.  I'd love to be able to back up the repos to my NAS (if that's even possible).

The next steps will be to pull repo files, edit them, and merge them, or to use it to create new repos (with new files, instead of just pushing large batches of old code to a GIT UI).