Question regarding gitignore on HassIO

Getting up and running with the latest version of HassIO and I wanted to backup my config files on github. I’m following the instructions in the docs but I’m running into 2 issues.

  1. When i run the git commit command it shows all of the files. This includes my secrets.yaml file even though my .gitignore file is copy/pasted from the docs. Is there something wrong with my .gitignore file or is this normal?

  2. After running git commit it allows me to enter a commit message like the docs say…but how to you actually finish the commit!! It seems like I’m stuck in editor mode. I found that CTRL+Z will abort the commit.

I’m running putty on windows 10 to SSH into my RiP3. I’ve googled around but haven’t been able to find a solution, hoping someone here can help.

EDIT: I have not installed the git pull add-on, I don’t think this should matter but figured I’d mention it.

Maybe share your gitignore file and let us see?

Lol. Sounds like vi.

Ctrl+C should get you to a point where you can do wq which means write (save) and quit

VI needs to suffer a painful death… Nano is much better I find particularly for newbies.

God yes, vi has lots of uses, and many fans, but it is not for beginners. I recall installing BSD as an experiment. The only editor in the basic install is vi, and to change shell you need to use chsh but that uses vi and I could never remember how to use it so I had to reboot my only computer to another OS to google for how to work vi and write it down and boot back to BSD and …

1 Like

First thing I do on a fresh Linux system is installing vim. Opinions can obviously be very different. :laughing:

Just using the git ignore file from the docs.

# Example .gitignore file for your config dir
*
!*.yaml
!.gitignore
secrets.yaml
known_devices.yaml

So true. Newbies will end up tearing their hair out though! It is not an intuitive editor to use in any way unless you cut your teeth on it.

And this .gitignore file is in the same directory as your configs?

How did you create the file? If you’re using a text editor on your Windows desktop you need to make sure that it is saved with Unix line endings.

Pro-tip, you can avoid having to use the editor to enter a commit message by using the -m flag:

git commit -m "Initial commit of my Home Assistant configuration."

Thanks stibbons, I was using notepad++ on windows and needed to use the unix line endings. I deleted the local git repo and did a fresh git init and everything worked perfectly!

1 Like

Glad you’ve got it working. :smiley:

For what it’s worth, some stuff in Linux will work with Windows-style line endings (I’m pretty sure Home Assistant configuration / python’s yaml parser in general will). But as you’ve discovered, not everything does. It’s pretty good practice to get in the habit of using Unix line endings for all of your work with HassIO and your Raspberry Pi.

1 Like

Yeah why microsoft decided to change a years old standard in terms of line endings is a bloody mystery.

This comment made me chuckle… VI is one of the most powerful editors out there, so it ain’t dying any time soon! lol. But I totally understand your pain if you’re not accustomed to using it.