Code Monkey home page Code Monkey logo

Comments (2)

johannesHarness avatar johannesHarness commented on July 19, 2024

Hey @dkrishnan7hub, that's a good question 🚀

Regarding the following statement:

... the file thats exceeding the size limit is within the .git folder
.git\objects\31\c3dd7f2bf911dc68461ec6cbff002d9cce017d

The feature only blocks files above a configured size limit from being pushed to the remote repository, but doesn't prevent you from creating and committing such files locally.

In your case, you most likely created and committed such a limit exceeding file locally, and where you were trying to push it, gitness blocked it (I assume the folder you were referring to was your local clone, as the .git folder indicates it's not a bare repo)

There's a few ways you can resolve your problem:

1. Remove the file that's exceeding the file limit

In case the file was committed by accident, or isn't really needed, you can remove the file to resolve the problem.
For that you'll have to remove the file from every commit in which the file exceeds the limit, which might be harder depending on how far back it is in your local commit history. In your case, it seems there's only one version of the file that's exceeding the size limit (e.g. 31c3dd7f2bf911dc68461ec6cbff002d9cce017d)

Some useful commands:

  • find commits on your branch that added the object: git log --find-object=31c3dd7f2bf911dc68461ec6cbff002d9cce017d
  • find the file path(s) of the object for a given commit: git ls-tree -r COMMIT_SHA | grep 31c3dd7f2bf911dc68461ec6cbff002d9cce017d
  • If the object was introduced with the most recent commit, you can just remove the file and then git commit --amend to update the latest commit. However, if the object was introduced further in your commit history, it can get more tricky to do manually.

After you've removed ALL occurrences of the file (e.g. git log --find-object=31c3dd7f2bf911dc68461ec6cbff002d9cce017d returns an empty response), you should then be able to push your branch without any issues.

2 Decrease the file size

If you can't remove the file, but it's possible to reduce it's size, you can follow the same steps as above, but instead of removing the file from ALL commits where it exceeds the limit, you'll have to update it.

3. Increase the file size limit for the repo

If the file is necessary and can't be removed or decreased in size, you can update the max file size limit of the repository.
This will only update the limit for that specific repository, other repositories will still maintain their previous limit (100MB by default).
There's no UI support as of now, so you'll have to use the following API:

curl '{GITNESS_ENDPOINT}/api/v1/repos/{REPO_PATH}/+/settings/general' \
-H 'Authorization: XXX' \
-X PATCH \
--data '{
    "file_size_limit": 1000000
}'

NOTE: limit is in Bytes, above is the default value

You can then verify the new limit has been set correctly by making the following API call:

curl '{GITNESS_ENDPOINT}/api/v1/repos/{REPO_PATH}/+/settings/general' \
-H 'Authorization: XXX'

from gitness.

johannesHarness avatar johannesHarness commented on July 19, 2024

Closing this issue for now, feel free to reopen if there's a related issue.

from gitness.

Related Issues (20)

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.