Github gives error "Unable to create the new repository because there are too many new files in this directory"

683 Views Asked by At

I'm trying to upload an Unreal 5 game I've been prototyping to github so that the rest of my team can collaborate on it.

I have github installed, and when I try to create a new repository (located in the SSD where the game is saved) I get the above error. Any ideas on how to get around/fix this?

It must be possible to upload existing projects right?

Note: after saying that error it takes me back to the Create a New Repository window and I am unable to use the Create repository button again.

Create Repository after attempt

2

There are 2 best solutions below

0
On

Unreal Engine generates a lot of files that don't belong in Git (compiled files etc). It might help if you add a .gitignore file to the root of your project so that Git filters them out. Here's an example file you could start with: https://github.com/github/gitignore/blob/main/UnrealEngine.gitignore

Another thing you might run into is the files being too "big" for git. You will need to install git lfs, or large file system. You can install this from the command line, git lfs install. I am not sure what app you're using it might have a similar option.

You should also create a .gitattributes file to handle binary files correctly. Here's an example file to start with: https://github.com/MOZGIII/ue5-gitignore/blob/master/.gitattributes

This should apply to most game dev projects when using git/github to manage source

0
On

The error "Unable to create the new repository because there are too many new files in this directory" can appear when working with Unreal Engine projects if there's too many files that shouldn't be in Git (like binaries, image files, compiled files, etc.). Git should be for the most part code-focused. What you can do to resolve this error is to either add a .gitignore file, in which you specify which files should be ignored, or you initialize Git LFS and add a .gitattributes file to specify which files should tagged as LFS.

If you have already started without LFS but want to switch, you can still work through the past: How do I "fix" a missing lfs pattern, and rewrite history? Basically you use the git lfs migrate import command This rewrites the history without having to create a rebase.

And in regards to maintaining a fairly comprehensive .gitattributes that includes all important file types, here's a great resource: .gitattributes with Unreal extensions The most important attributes are:

*.uasset filter=lfs diff=lfs merge=lfs -text
*.UASSET filter=lfs diff=lfs merge=lfs -text
*.upack filter=lfs diff=lfs merge=lfs -text
*.UPACK filter=lfs diff=lfs merge=lfs -text
*.upk filter=lfs diff=lfs merge=lfs -text
*.UPK filter=lfs diff=lfs merge=lfs -text
*.umap filter=lfs diff=lfs merge=lfs -text
*.UMAP filter=lfs diff=lfs merge=lfs -text

+add image file types using the same syntax as you see above.