charmbracelet / soft-serve

The mighty, self-hostable Git server for the command line🍦
MIT License
5.16k stars 127 forks source link

Error "Bummer -- not a git repository" when folder is a git repo #514

Closed yamzee closed 3 months ago

yamzee commented 3 months ago

Describe the bug Recently ran a backup on one of my docker hosts, and was testing if the backups were working. I pulled in the soft-serve folder from the .tar archive I made of the repo, spun it up, and ssh'd in. I go to open a repo and am told it's not a git repository?

I use tarballs to store the backups since you usually need root permissions to scp/rsync the files over, and I never have root via ssh enabled (for obvious reasons). I also do not wish to mess up permissions via chown -R

All the repos are BARE repos, untouched. Pushing to them gets them updated, albeit with an error, but soft-serve does not allow me to view or pull repos anymore.

To Reproduce Steps to reproduce the behavior:

  1. Throw the folder in a tarball when container isn't running
  2. Untar the file
  3. Bring up soft-serve with docker-compose
  4. Try to open the repo

Expected behavior That it functions like a normal repo.

Environment:

lightlike commented 3 months ago

Have you tried just unpacking the Repo locally, creating an empty repo in soft-serve and just setting the repo origin and than (force)-pushing everything to the new origin? I think that might work better as soft-serve changes some git settings (I think at least hooks) that might cause problems when just uploading the raw files.

Not tested but you could try something like this:

git remote set-url origin *new url*
git push origin --all
git push origin --tags

You might need to force-push if soft-serve does something with the git history.

More information here: https://gist.github.com/niksumeiko/8972566

yamzee commented 3 months ago

Sounds like a plan, since I have more recent local changes than the repo.

Oddly enough, when I tried this on another system (did a docker compose pull first, this time) it worked right out of the box. I'll proceed by pushing to it to recreate the repos, and archive these weird backups :-)