Skip to content

Warn me before I commit large files without using Git LFS #997

Closed

Description

@tierninho

Dropped a 1G file in my local repo and committed it. No error validation prevented me from doing so.

Do we have a limit as I tried dropping same file into dotcom UI and was limited to 100MB? Isn't LFS supposed to do this?

screen shot 2017-03-01 at 4 08 57 pm

Activity

  1. shiftkey commented on Mar 2, 2017

    @shiftkey
    Member

    Nope, we don't do any checks or limitations on what you commit. Given we have Git LFS included we could definitely provide better guidance here.

    Probably not in scope for the beta, given the existing apps didn't do any sort of guidance either.

  2. added
    design-input-needed
    on Mar 2, 2017
  3. shiftkey commented on Jul 3, 2018

    @shiftkey
    Member

    #5079 was opened to indicate that it'd be nice to even list the files that were committed that are over 100MB - the Git server doesn't include these when it fails the git push - but I think it'd be nicer to warn the user before committing.

  4. added
    help wanted
    on Sep 24, 2018
  5. billygriffin commented on Sep 24, 2018

    @billygriffin
    Contributor

    We've seen this pop up pretty frequently and we'd love it if someone from the community wanted to take a look at a potential check on large files before committing, unless using Git LFS.

    Considerations:

    1. This should not materially slow down the speed of commits (will likely be most visible when a user is committing a lot of files).
    2. It should still work as it does today with Git LFS configured (in other words, there shouldn't be a warning if someone is using Git LFS).
    3. The warning should let the user know which file(s) are over 100MB (reference List what files are over 100mb when reporting files are over 100mb. #5079).
  6. canerelci commented on Oct 16, 2018

    @canerelci

    image

    I have no idea which one of hundreds of files...

  7. removed
    design-input-needed
    on Oct 16, 2018
  8. HedvigS commented on Oct 18, 2018

    @HedvigS

    I have the same problem. I often find myself not being able to find the file (because it's actually no longer there and just buried in commit history) and resolve the conflict. My current method of solving these situations is rather crude :/ , but has proven successful.

    • move the folder where I have made changes to outside of the repos
    • remove the clone from Github Desktop and move to trash
    • re-clone the same repos
    • put the folder back into re-cloned repos
    • comity and push and pull again
  9. steveward commented on Oct 18, 2018

    @steveward
    Contributor

    @canerelci @HedvigS if you are having issues tracking down the specific large files you need to remove from your repository the log file from GitHub Desktop will provide the filenames. You can find the log file by going to the file menu in GitHub Desktop and selecting Help > Show Logs in Finder (macOS) or Explorer (Windows). Please be sure to upload a log file from a day where you experienced the error in your screenshot. I would be happy to take a look at the log and let you know what files you need to remove.

    You can also search the log file directly by looking for the This file exceeds GitHub's file size limit of 100MB error message -- that error will be preceded by the filename.

  10. HedvigS commented on Oct 18, 2018

    @HedvigS

    Thanks @steveward . The problem now is more to do with the resolution, I just thought it'd be good if the dialogue box also included this information.

    If I've committed a file to my local branch that's too large, even if I remove it from the folder I still can't push. Hence the whole re-cloning thing :)

  11. shiftkey commented on Oct 18, 2018

    @shiftkey
    Member

    If I've committed a file to my local branch that's too large, even if I remove it from the folder I still can't push. Hence the whole re-cloning thing :)

    @HedvigS this is because it's still preserved in the Git history in a previous commit, and pushing the branch after cleaning it up will still try to push that old commit containing the 100MB file

  12. HedvigS commented on Oct 18, 2018

    @HedvigS

    @shiftkey Yes.
    So could there be a stop at the commit level already instead of later at the push-stage?
    Or is there an easy way to clean the commit history inside the app right now?

  13. 19 remaining items

  14. outofambit commented on Oct 26, 2018

    @outofambit
    Contributor

    I believe all that is left is clearing the commit summary afterwards.

    Oh nice!! Ok, so my thoughts on that are to pass a (fat arrow) function to the popup that wraps the clearCommitMessage function and then call that from the popup if the commit is successful. Does that make sense? Its a little bit of a hack but it should work (and if others have better ideas they can comment on the PR).

  15. Daniel-McCarthy commented on Oct 26, 2018

    @Daniel-McCarthy
    Member

    @outofambit
    This is what I had tried initially with a couple of the other functions and I couldn't seem to get it working as expected. I gave it a try again with the clearCommitMessage function but it errors out saying that "this.setState is not a function".

    Perhaps there is another way to do it? I tried by passing the function as () => void to the dispatcher and passing it to the dialog via props.

  16. outofambit commented on Oct 26, 2018

    @outofambit
    Contributor

    @Daniel-McCarthy i bet its because

    private clearCommitMessage() {
    this.setState({ summary: '', description: null })
    }

    is not bound to the component instance. 😞

    i'm wondering if we should solve that in a different PR after your PR and #5809 land (since both have the same issue). i'm thinking we need to use the dispatcher et al to reset the commit-message state whenever a commit is made (i think this would mean setting the app's state directly inside app-store and calling emitUpdate. i'm happy to take a run at that and put a PR up for it on monday. How does that sound?

  17. Daniel-McCarthy commented on Oct 26, 2018

    @Daniel-McCarthy
    Member

    @outofambit
    If I understand correctly, you're suggesting proceeding to a PR for the current progress and addressing the issue of the commit message clearing separately?

    Does this mean I should create the PR as it is without the code that tries to call the clearCommitMessage function?

    I think that would be wonderful if you're interested in taking a look at this issue. Thanks again for your help!

  18. outofambit commented on Oct 26, 2018

    @outofambit
    Contributor

    If I understand correctly, you're suggesting proceeding to a PR for the current progress and addressing the issue of the commit message clearing separately?

    Does this mean I should create the PR as it is without the code that tries to call the clearCommitMessage function?

    @Daniel-McCarthy yes exactly! thank you again! just mention that its a known issue in the PR description and tag me as agreeing to fix that separately :)

  19. Daniel-McCarthy commented on Oct 26, 2018

    @Daniel-McCarthy
    Member

    @outofambit Fantastic! I will do that now.

  20. modified the milestone: 1.5.0 on Oct 29, 2018
  21. outofambit commented on Oct 29, 2018

    @outofambit
    Contributor

    @Daniel-McCarthy

    i'm thinking we need to use the dispatcher et al to reset the commit-message state whenever a commit is made (i think this would mean setting the app's state directly inside app-store and calling emitUpdate.

    apparently this already exists! its just buried here:

    public setCommitMessage(
    repository: Repository,
    message: ICommitMessage | null
    ): Promise<void> {
    return this.appStore._setCommitMessage(repository, message)
    }

    so you (and I) should be able to call this dispatcher method to clear the field! 🎊

  22. shiftkey commented on Oct 29, 2018

    @shiftkey
    Member

    @outofambit @Daniel-McCarthy best of luck - last time I was looking at "how can i clear the commit form programatically" I had some regrets and eventually had to roll back the changes - #5208 #5260 #5269

  23. outofambit commented on Oct 29, 2018

    @outofambit
    Contributor

    thanks for the heads up @shiftkey ! i'm gonna say let's stick with the original plan of that being its own PR then (that I'll take on).

  24. shiftkey commented on Oct 29, 2018

    @shiftkey
    Member

    @outofambit I will say a little prayer for you

  25. changed the title [-]No check on committing large files [/-] [+]Warn me before I commit large files without using Git LFS[/+] on Nov 7, 2018
  26. added a commit that references this issue on Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions