Github invalid head problem - with Pictures! :D

Discussion in 'Mod Discussions' started by mered4, November 23, 2014.

  1. mered4

    mered4 Post Master General

    Messages:
    4,083
    Likes Received:
    3,149
    First: @cola_colin

    Now, I've been trying to add some new changes to the Community UberBalance, but the repository is giving me some problems. Here are some screenshots. :D

    [​IMG]
    [​IMG]
    Any ideas?
  2. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    well it seems there is no git repository. Dunno.
  3. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Is there a .git directory, and what is in it?

    I was able to pull a working repo (at least for read) from github, so you could always fall back to that.
  4. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361
    Open a command line in that directory. Then type
    git status

    If it says there is not git repo in that directory then you have to type
    git init
    git remote add origin <repo url>

    Then type
    git add --all
    git commit -m "<Insert message here>"
    git push origin master

    If it does not say there is no repo existant(Aka a repo exists) then please paste the error in here. Git can be weird some times.
    Last edited: November 27, 2014
    mered4 likes this.
  5. mered4

    mered4 Post Master General

    Messages:
    4,083
    Likes Received:
    3,149
    I'll try that sometime tonight. Working on a Starmade speed build here.
  6. nixtempestas

    nixtempestas Post Master General

    Messages:
    1,216
    Likes Received:
    746
    The simplest way I've found to fix this issue is delete the local repo and reclone it. It is caused by a missing/corrupted .git

    edit: specifically, you'll need to delete both the repo in github for windows, and from the file system.
  7. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361
    That can cause you to loose work if you have not commited and pushed your changes(At least with CLI, maybe Github windows merges keeping your files)
  8. mered4

    mered4 Post Master General

    Messages:
    4,083
    Likes Received:
    3,149
    I actually have made some unintended changes that I DON'T want on the online version - I meant to use GH to check which files I changed by accident. But voila, it says the repo head doesn't exist! (I didn't touch .git lol)
  9. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361
    Well if you run
    git status

    You can see what files you have changed(Unless there is error, in which case please post)

    You can run
    git checkout -- <filename>

    To revert a file back to its state on the remote(Aka github)
    mered4 likes this.

Share This Page