Search code examples
gitgitstack

Recovering GitStack installation?


My old laptop died with my GitStack installation and local Git repositories on it. It was a hardware issue, and the hard drive wasn't affected (I have the hard drive attached to my new computer and it works with no issues). Of course, I want to install GitStack on my new computer and migrate the old repositories into the new installation. I couldn't find any documentation on this. Has anybody done this, or does anybody knowledgeable about GitStack have any advice for me?

Edit: the user poke who responded was very knowledgeable. Rather than fighting with GitStack -- which appears less supported than it used to be -- I was able to install a local Git for Windows server, and push the contents from my old hard drive as a new repository by using remotes. It worked perfectly.

  1. I installed Git for Windows according to the tutorial

  2. I created a bare repository somewhere on my disk: git clone --bare C:\Repositories\Blah.git

  3. I navigated into the repository from the disk pulled out of my old laptop

  4. The existing ./.git/config file still referenced my old GitStack local server. I removed that via git remote remove origin

  5. Now my existing repo needed to be updated to refer to the Git for Windows local server installed in step 0. The command was: git remote add origin myusername@localhost:C:/Repositories/Blah.git

  6. The Git for Windows tutorial mentioned some special configuration is presently needed for working around an issue with the current builds. In particular, the tutorial instructs you to enter these commands in your repositories:

    git config --local remote.origin.uploadpack "powershell git-upload-pack"

    git config --local remote.origin.receivepack "powershell git-receive-pack"

  7. I pushed the master branch to the origin via: git push -u origin

  8. I switched to the student branch via: git checkout student

  9. I pushed the student branch to the origin via: git push -u origin

  10. Then, to test, I created a new repository elsewhere:

git init Blah cd Blah [same commands from steps 5 and 6] git fetch git pull origin master

  1. From there I could switch between branches without having to merge, as expected, via git checkout student.

Solution

  • I don’t have experience with GitStack but apparently it does store its repositories within C:\GitStack\repositories. So you should be fine with just reinstalling it and then recovering your repository data from your old C:\GitStack\repositories.

    In case there are some repository-unrelated settings, those might be stored within C:\GitStack, so you could try to recover those from there too. I would assume that as long as you install the same version as your previous installation, you can just recover all files from C:\GitStack.

    And of course, as Git is a distributed version control system, this means that every local repository is a full clone of the remote repository. So if recovering the repositories does not work, you can also simply create new repositories in GitStack and then push the old history from your local repositories to it. That way you will be able to recover all the history completely.