1

I am having problems with Git, when pushing to the remote repository.

I did set up my own server, which is on my network (on a linux machine running Debian). If I commit few files, everything is fine, but when I try to upload a folder that has many files (like a Unity project); then I get errors

I did check permissions and they are fine; I did check the disk space, and I have 10 Gb free, while the commit is about 900 Mb, so it is not a space issue either.

Reading some other post; someone mention that such issues may be related to the fact that Git on the server is not configured correctly; although I was not able to find exactly what parameters do you use to allow Git on the server to accept any number of files, when I do a push from my local Git repo to the one on the server.

The error that I get is this:

 ! [remote rejected] master -> master (n/a (unpacker error))

How do I actually tell Git on my server, to just take any number of files ? It would take me forever to upload the Unity project in this way otherwise.

David
  • 15,894
  • 22
  • 55
  • 66
  • Are there any other warnings or interesting messages when you run the "git push" command? It would be best to just show the exact command you ran and post all of its output. Also, what OS are you running on the local machine? Can you show us how the remote is configured on your local machine (e.g. post the full contents of `.git/config`)? – David Grayson Dec 18 '15 at 01:38
  • Hi, This is the only message that I get; I am using a software called "sourcetree"; on Windows. The repository is basically empty; I just did an init and then did a local push of a text file, so there is nothing in it. Then I tried to push a Unity3D project, and I did receive this error. If I commit just few files at time, I can do it successfully (did try with 100 and 500 so far). Is there a parameter that force Git to take a certain amount of files? The folder has thousands of them, which may be why the error happen in first instance. In the Git config I have only the email and username set. –  Dec 18 '15 at 01:49
  • 1
    I really doubt that git has a maximum file limit, and if it did, it should give you a better error message when you exceed the limit. I'm not familiar with SourceTree, but it sounds like it might be hiding the full output of git from you and you should try to get the full output in case there are other errors or warnings in there. For example, this [other instance of an unpacker error](http://stackoverflow.com/questions/4025708/git-cant-push-unpacker-error-related-to-permission-issues) came with additional warnings that were useful in troubleshooting. – David Grayson Dec 18 '15 at 02:00

1 Answers1

0

I did find the issue.

Basically Unity is not "Git-friendly"; unless you set the editor itself in a certain way, and you create a proper exclusion list.

Partially expected since Unity sell their own repository manager application.

Anyway; this is what to do to get the projects to upload correctly.

1) Create an exclusion list with the following:

Temp/
Library/ 
ExportedObj/
obj/
*.svd
*.userprefs
/*.csproj
*.pidb
*.suo
/*.sln
*.user
*.unityproj
*.booproj
.DS_Store
._*
Thumbs.db

Save this file in something like .gitignore_global and add it to the home directory of the Git server.

Then call settings and set the exclude global list to this file:

git config --global core.excludesfile <path-to-.gitignore_global>

2) Open Unity3d, go to edit menu -> project settings -> editor and change as following:

-Version control mode: "visible meta files"
-Asset serialization mode: "force text"

Then you need to save your scene again, to let Unity to generate the correct assets. To be safe, save the project too and close Unity.

Now if you will try to upload the project folder; you will be successful, and will avoid to upload extra files.

I did try to launch the project from a fresh clone, and it works exactly as expected. It will take a bit moe when running the project, since Unity has to create again the various files that are not checked in.