thomiceli / opengist

Self-hosted pastebin powered by Git, open-source alternative to Github Gist.
https://opengist.io
GNU Affero General Public License v3.0
1.81k stars 98 forks source link

git in Docker image does not support push options #351

Open weierophinney opened 2 weeks ago

weierophinney commented 2 weeks ago

When using the docker image (ghcr.io/thomiceli/opengist:1), and following the instructions to use git options to set the title, url, or visibility, as described here:

I receive the following error:

fatal: the receiving end does not support push options

I have configured opengist with the following changes:

I can follow the instructions to create a gist from an initialized git repo per https://opengist.io/docs/usage/init-via-git.html, and this works correctly.

I have tried modifying the directions for initializing a gist via git to add the -o url="..." -o title="..." arguments, but receive the same error message.

I have also tried cloning the generated gist via git, and then calling git push -o ...; this results in the same error message.

My OpenGist installation reports:

weierophinney commented 2 weeks ago

Doing some research on this, it appears that the ability to push options is (a) per-repository, and (b) disabled by default. (See this SO issue for details.)

To see if there might be a simple solution that could be made in the Docker container creation, in a running container, I tried calling git config --global receive.advertisePushOptions true, and this solved the error message, but running a git push -o ... command did not actually make any changes in the gist repository. Further, including options in an initial push to the /init endpoint fails with the original error message reported.

As such, it looks like the InitRepository function needs to be updated to set the repository "receive.advertisePushOptions" to "true" on creating the bare repository.