Openhabian-config git error/corrupt

When starting openhabian-config, I get the git errors below (2.5M2, Raspbian GNU/Linux 9 (stretch)) :

2019-08-20_21:11:21_CEST [openHABian] Checking for root privileges... OK
2019-08-20_21:11:21_CEST [openHABian] Loading configuration file '/etc/openhabian.conf'... OK
error: object file .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029 is empty
error: object file .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029 is empty
fatal: loose object f8f70ec18d4dc7bd093044eb316b18b09dcbe029 (stored in .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029) is corrupt
error: object file .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029 is empty
error: object file .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029 is empty
fatal: loose object f8f70ec18d4dc7bd093044eb316b18b09dcbe029 (stored in .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029) is corrupt
error: object file .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029 is empty
error: object file .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029 is empty
fatal: loose object f8f70ec18d4dc7bd093044eb316b18b09dcbe029 (stored in .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029) is corrupt
2019-08-20_21:11:21_CEST [openHABian] openHABian configuration tool version: [master]-0()
2019-08-20_21:11:22_CEST [openHABian] Checking for changes in origin... error: object file .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029 is empty
error: object file .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029 is empty
fatal: loose object f8f70ec18d4dc7bd093044eb316b18b09dcbe029 (stored in .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029) is corrupt
fatal: The remote end hung up unexpectedly
OK
error: object file .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029 is empty
error: object file .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029 is empty
fatal: loose object f8f70ec18d4dc7bd093044eb316b18b09dcbe029 (stored in .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029) is corrupt
error: object file .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029 is empty
error: object file .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029 is empty
fatal: loose object f8f70ec18d4dc7bd093044eb316b18b09dcbe029 (stored in .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029) is corrupt
error: object file .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029 is empty
error: object file .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029 is empty
fatal: loose object f8f70ec18d4dc7bd093044eb316b18b09dcbe029 (stored in .git/objects/f8/f70ec18d4dc7bd093044eb316b18b09dcbe029) is corrupt

Any idea how to solve this?

If it doesn’t resolve all by itself try deleting /opt/openhabian/.git

If it doesn’t resolve all by itself try deleting /opt/openhabian/.git

Thanks for the suggestion. But it didn’t help.

[19:19:11] openhabian@openhabian:/opt/openhabian$ sudo openhabian-config
2019-08-22_19:19:14_CEST [openHABian] Checking for root privileges… OK
2019-08-22_19:19:14_CEST [openHABian] Loading configuration file ‘/etc/openhabian.conf’… OK
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
2019-08-22_19:19:14_CEST [openHABian] openHABian configuration tool version: -0()
2019-08-22_19:19:14_CEST [openHABian] Checking for changes in origin… fatal: not in a git directory
fatal: not in a git directory
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
OK
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git

I’m not 100% sure it does work, but I did the following:

sudo git clone GitHub - openhab/openhabian: openHABian - empowering the smart home, for Raspberry Pi and Debian systems /opt/test
rm -R /opt/openhabian/.git
cp -R /opt/test/.git /opt/openhabian
rm -R /opt/test

Then

sudo openhabian-config

I now get the following, what doesn’t look too bad:

[19:32:41] openhabian@openhabian:/opt/openhabian$ sudo openhabian-config
2019-08-22_19:32:48_CEST [openHABian] Checking for root privileges… OK
2019-08-22_19:32:48_CEST [openHABian] Loading configuration file ‘/etc/openhabian.conf’… OK
2019-08-22_19:32:48_CEST [openHABian] openHABian configuration tool version: [master]v1.5-504(a342f21)
2019-08-22_19:32:49_CEST [openHABian] Checking for changes in origin… OK
2019-08-22_19:32:52_CEST [openHABian] Updating myself… OK - No remote changes detected. You are up to date!

Maybe this helps someone else.

I had a different git-related error, and have a slightly more streamlined solution that builds on yours @Jean-Marc_Autexier .

openhabian-config gave me errors trying to update to OH3:

There was an error or interruption during the execution of:
  "01 | Update"

Please try again. Open...

In the console I found lots of:

fatal: bad config line 1 in file .git/config

That file was binary looking, yet in other git repos I’ve used, it’s text.

So I did this:

mv /opt/openhabian/ /opt/openhabian.corrupt
sudo git clone https://github.com/openhab/openhabian.git /opt/openhabian

Now openhabian-config is upgraded and offers to upgrade to OH3!