xcodegithubcocoapods

How to ignore large file uploads in git? For example dependencies?


Good afternoon everyone.

An error occurs when uploading a repository to Git. This is error "File Pods/MyPath/YandexMapsMobile.xcframework/ios-x86_64_arm64-simulator/YandexMapsMobile.framework/YandexMapsMobile is 409.37 MB; this exceeds GitHub's file size limit of 100.00 MB GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com." Tell me how to ignore file uploads in Git? I found a solution for another project, but did not save the example. I can’t google it anyway.

Adding to the gitignore file didn't help.


Solution

  • Good Afternoon. You can ignore large files in Git by using the .gitignore file or by removing the file from the repository history. However, if the file is already committed, using Git Large File Storage (LFS) is a good solution for managing large files.

    Open (or create) a .gitignore file at the root of your repository. Add the path to the main file:

    pod / MyWay / YandexMapsMobile . xcfframework / ios - x86_64_arm64 - simulator / YandexMapsMobile . settings / YandexMapsMobile
    

    Using the Large Git File Store (LFS). https://git-lfs.com/ You can use Git LFS to control which file sizes need to be version maintained. Here’s how you can do it. Install Git LFS:

    Twe is installed Git LFS fee https://git-lfs.github.com/ . Start Git LFS on your repository:

    Installed git lfs

    Use Git LFS to track a large file:

    Follow a specific file or files:

    git lfs track "Pods/MeKwan/YandexMapsMobile.xcframework/ios-x86_64_arm64-simulator/YandexMapsMobile.framework/YandexMapsMobile".
    

    Commit to change:

    After adding tracking information, you must commit to changing:

    git includes .gitattributes
    git commit -m "Use Git LFS to track file sizes".
    

    Room changes:

    Push the changes to your remote repository:

    git push start your-branch-name
    

    Remove file size from history

    If you have already installed a large file and need to remove it from your archive history, follow these steps.

    Extract a large file:

    git rm --cached "Pods/MeKwan/YandexMapsMobile.xcframework/ios-x86_64_arm64-simulator/YandexMapsMobile.framework/YandexMapsMobile".
    

    Here are the DOCS LFS : https://github.com/git-lfs/git-lfs/tree/main/docs?utm_source=gitlfs_site&utm_medium=docs_link&utm_campaign=gitlfs

    Hope this will help you, Best Regards