user1603164
user1603164

Reputation: 387

Does anybody know how to reject commits with CRLF line endings on Bitbucket?

We want to keep the line endings of committed files to be consistent, permit only unix format, reject any commits which contain CRLF on the server side. But I do not know how to set up pre-receive hook on Bitbucket.

Upvotes: 3

Views: 1027

Answers (1)

larsks
larsks

Reputation: 311645

You cannot set up a pre-receive hook on BitBucket. Hooks like this allow arbitrary code to execute on the server and simply aren't a viable option for a hosting service like this. If you need custom hooks like this you need to host your own repository.

You could distribute a pre-commit hooks to contributors that they can install in their local repositories to reject commits containing this sort of line ending.

You could receive notifications of new commits via a post-receive hook, which BitBucket implements by calling out to a URL of your choice, but at this point the changes have already been committed to the repository.

Upvotes: 1

Related Questions