Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the receive.denyNonFastForwards on a repository in GitHub

Tags:

git

github

I have a repository hosted on GitHub which has several forks.

How can I set up the config of the main repository to set the receive.denyNonFastForwards flag so that the main repository can only accept pushes which are fast forwards and will reject any non fast forwards even if they are --forced

like image 913
Sam Holder Avatar asked Oct 22 '12 16:10

Sam Holder


People also ask

How do I set up remote origin?

To add a new remote, use the git remote add command on the terminal, in the directory your repository is stored at. The git remote add command takes two arguments: A remote name, for example, origin.

How do you change the repository you are pushing to?

You will need to 1) fork the project you want to make changes to into your own github account, 2) clone that forked repo to your local, 3) make changes, 4) push to your own repo.


1 Answers

GitHub does not expose this functionality, though there are two options:

  • GitHub support can set this on a repository.

  • You can emulate this by setting the GitHub repository as a mirror of another repository that you have more control over. Only give write access to the GitHub account to a minimal set of responsible individuals, and to an account used to do the mirroring. The non-GitHub repository would be where you would set receive.denyNonFastForwards, and have everyone push. The mirroring could then be done by a post-receive hook, cron job, or a combination of the two. A reason to go with both would be to get a minimal time lag between the two repositories, and still make sure everything is up to date even if the post-receive hook failed to update GitHub (if GitHub was down, for example).

like image 70
Jacob Helwig Avatar answered Oct 03 '22 23:10

Jacob Helwig