How do I recover from pushing a gitosis.conf file with parsing errors due to line breaks?

前端 未结 2 1178
清歌不尽
清歌不尽 2021-02-19 01:10

I have successfully set up gitosis for an Android mirror (containing multiple git repositories). While adding a new .git path following writable= in gitosis.conf I managed to in

相关标签:
2条回答
  • 2021-02-19 01:55

    You can actually do something slightly more clever. Since gitosis-admin.git is a git archive, you can clone it locally, reset to a working version and commit the change. One trick is that you have to do everything as the "git" user.

    We did it this way, but we plan to change to gitolite, which checks for errors before incorporating changes for just this reason.

    change to an empty directory to which the "git" user has write access

    sudo -H -u git git clone (gitosis repo directory)/gitosis-admin.git

    cd gitosis-admin

    sudo -H -u git git rebase -i (commit id of last known working state)

    e.g.

    sudo -H -u git git rebase -i HEAD^^

    with the interactive flag, it's harder to make a mistake; follow the directions to pick only the right (known to work) commit

    sudo -H -u git git push -f origin master

    The -f flag forces git to do the push even though the master branch in the repo is not an ancestor of your new branch. This should fix the problem, and you should be able to push/pull as normal from your local branches.

    0 讨论(0)
  • 2021-02-19 02:03

    I do this all the time. :-) The answer is to log on to the gitosis server and edit the copy of the config file there. In the home directory of the user that owns the gitosis instance there should be a link named .gitosis.conf (it actually points to gitosis-admin.git/gitosis.conf). Edit that file and fix the problems there; then, when you push next, it will be fine.

    0 讨论(0)
提交回复
热议问题