Daily Update error - GIT

-bash-4.2$ git pull origin master
fatal: No such ref: HEAD
From https://github.com/librenms/librenms
 * branch            master     -> FETCH_HEAD
error: unable to resolve reference HEAD: No such file or directory
fatal: Cannot lock the ref 'HEAD'.
git gc --prune=now
git remote prune origin
git pull

Run out of disk space on this server previously? Your git is corrupted :frowning: We should be able to repair it.

Run git remote -v too

-bash-4.2$ git gc --prune=now
error: bad ref for refs/heads/master
error: bad ref for refs/heads/master
Counting objects: 139266, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (41574/41574), done.
Writing objects: 100% (139266/139266), done.
Total 139266 (delta 95715), reused 138603 (delta 95292)
error: bad ref for refs/heads/master
Checking connectivity: 139266, done.

-bash-4.2$ git remote prune origin
Pruning origin
URL: https://github.com/librenms/librenms.git
 * [pruned] origin/kkrumm1-patch-2

-bash-4.2$ git pull
fatal: No such ref: HEAD
remote: Enumerating objects: 20, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 24 (delta 12), reused 11 (delta 9), pack-reused 4
Unpacking objects: 100% (24/24), done.
From https://github.com/librenms/librenms
   fffd468..b571482  master     -> origin/master
fatal: No such ref: HEAD
You are not currently on a branch. Please specify which
branch you want to merge with. See git-pull(1) for details.

    git pull <remote> <branch>

-bash-4.2$ git pull  origin master
fatal: No such ref: HEAD
From https://github.com/librenms/librenms
 * branch            master     -> FETCH_HEAD
error: unable to resolve reference HEAD: No such file or directory
fatal: Cannot lock the ref 'HEAD'.

-bash-4.2$ git remote -v
origin  https://github.com/librenms/librenms.git (fetch)
origin  https://github.com/librenms/librenms.git (push)

rm .git/refs/heads/master
git reset

Hmm I wonder if that last one was a good idea or not.
git fetch
echo ref: refs/heads/master >.git/HEAD
git checkout master
git pull

We might have to do echo 2eac72d34b2246255b260840db948bf8a4ed3316 > .git/refs/heads/master

That worked

echo 2eac72d34b2246255b260840db948bf8a4ed3316 &gt; .git/refs/heads/master

Then the git checkout master run ok.

D       tests/tests.py
D       validate.php
D       webpack.mix.js
Already on 'master'
Your branch is behind 'origin/master' by 4 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

-bash-4.2$ git pull
Updating 2eac72d..b571482
error: Your local changes to the following files would be overwritten by merge:
        LibreNMS/Authentication/ADAuthorizationAuthorizer.php
        LibreNMS/Authentication/ActiveDirectoryAuthorizer.php
        LibreNMS/Authentication/LdapAuthorizationAuthorizer.php
        LibreNMS/Authentication/LdapAuthorizer.php
        LibreNMS/Exceptions/DatabaseConnectException.php
        README.md
        app/Checks.php
        app/Console/Commands/AddUserCommand.php
        app/Exceptions/Handler.php
        app/Http/Controllers/Table/FdbTablesController.php
        app/Models/PortsFdb.php
        daily.php
        daily.sh
        doc/Support/Configuration.md
        doc/Support/Discovery Support.md
        doc/Support/Features.md
        html/pages/device/port/fdb.inc.php
        html/pages/device/ports/fdb.inc.php
        html/pages/search/fdb.inc.php
        includes/defaults.inc.php
        includes/discovery/fdb-table.inc.php
        misc/db_schema.yaml
        tests/data/edgecos_es3510ma.json
        tests/module_tables.yaml
Please, commit your changes or stash them before you can merge.
error: The following untracked working tree files would be overwritten by merge:
        database/migrations/2019_02_10_220000_add_dates_to_fdb.php
Please move or remove them before you can merge.
Aborting

Great, now you just need to run ./scripts/github-remove -d and ./daily.sh (You should run ./validate.php too)

Excellent Murrant!
Thank you very much!

1 Like