GithubHelp home page GithubHelp logo

ethanlmiller / git_commit_limit_size Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 10 KB

Python script for pre-receive hook to limit the commit size for git repositories

License: BSD 2-Clause "Simplified" License

Python 100.00%

git_commit_limit_size's Introduction

git_commit_limit_size

Overview

This is a Python script for pre-receive hook to limit the commit size for git repositories. It can set the following limits:

  • Limit the maximum size of any individual file
  • Limit the total size of all files being committed
  • Limit the number of files being committed

The script is designed as a hook that runs on many repos, for installations such as GitLab. Limits are set in a configuration file, using Python 3 regular expressions against which the repository name is matched. Each line specifies all three limits for a particular regular expression, with 0 for a specific limit meaning "no limit". Limits are set by the first line with a matching regular expression. It is recommended that the last line contain the regular expression .*, which matches all repositories.

Contents

  • limit_size.py: pre-receive hook to limit the size of files and entire git repostories
  • limit_size.conf: sample configuration file for limit_size.py

Requirements

There are no requirements for installation beyond Python 3 and git.

Contributors

git_commit_limit_size's People

Contributors

ethanlmiller avatar

Watchers

 avatar

git_commit_limit_size's Issues

Error when deleting upstream branch without permissions

I was trying to delete a remote branch which I do not have the permissions to modify. Instead of giving me a permission error it gives me the following.

~/source/repos/cse13e (master) > git push bsoe :develop                                 [0]
remote: Traceback (most recent call last):
remote:   File "/home/gitlab/hooks/pre-receive.d/limit_size.py", line 205, in <module>
remote:     raw_repo_path = os.environ['PWD']
remote:   File "/usr/lib/python3.6/os.py", line 669, in __getitem__
remote:     raise KeyError(key) from None
remote: KeyError: 'PWD'
To gitlab.soe.ucsc.edu:cse13e/winter21/jtmadden.git
 ! [remote rejected] develop (pre-receive hook declined)
error: failed to push some refs to 'gitlab.soe.ucsc.edu:cse13e/winter21/jtmadden.git'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.