Can anybody see the download for the .gitignore file?

Any help with this would be great!

Hi @Mark_Spain,

It is linked from the Resources on the specific lecture (Using SourceTree and Git / Lecture 268)

Here’s the URL it points to;

Hope this helps. :slight_smile:

Thanks Rob,

I did take a look at this link during the video, but I couldn’t figure out what to do. I saved the text down in a text file and saved as Unity.gitignore, but that didn’t seem to do anything. Maybe I didn’t quite follow what to do from the lecture, but it feels like I’m just doing it completely wrong.

Did you manage to get it working on your end?

Hi Mark,

Is the file in the root of your git repository? Also, just check it doesn’t have a .txt extension.

Hi Rob,

Thanks for getting back to me.

I had another go at making the file and saved as “Unity.gitignore” under all file types. This seems to make a .gitignore file, rather than a .gitignore.txt. However, now when I commit, it ignores it and just brings in the library anyway.

I’ve included a screenshot, is it definitely in the right place?

image

Hi Mark,

I don’t use SourceTree myself, however, I do use Git.

The location of your .gitignore file looks correct. One noticeable difference between mine and your screenshot, is mine doesn’t have the filename, only the extension, e.g .gitignore, not entirely certain that would make a difference however, I’m fairly confident that Git only concerns itself with the extension.

Another couple of things to consider.

Had you already committed to your repository, including the /library, directory prior to using the .ignore file?

What is the content of your ignore file, you can open them with a standard text editor.

I have these entries at the top of mine for example;

/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/

The top line in this snippet is the one which is preventing the /library/ directory from being included in a commit.

Hi Rob,

I didn’t commit until I had the .gitignore file in the directory, so the initial commit includes a .gitignore file, but it didn’t work.

image

The contents of the .gitignore as requested:

/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/Assets/AssetStoreTools*

Visual Studio 2015 cache directory

/.vs/

Autogenerated VS/MD/Consulo solution and project files

ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb

Unity3D generated meta files

*.pidb.meta

Unity3D Generated File On Crash Reports

sysinfo.txt

Builds

*.apk
*.unitypackage

So, are you saying that having performed the initial commit, the /library/ directory was committed?

Yes, the library directory was committed in the initial commit.

I did this on a Test project with no extras, so it was pretty small anyway. But I’d prefer to get the .gitignore file working so it doesn’t keep bringing in the library, and any associated changes.

Ok.

As a little test then, again, with a test project, try only committing the .gitignore file on the initial commit.

Then, run another commit and see if the /library/ directory is in fact ignored.

Using Windows and just using GUI tools, you’re not able to create a file without a filename (ie, .gitignore) without doing some weird stuff. You’d be better off creating the repository with Github’s GUI program; SourceTree is generally better, but it has issues on Windows with certain things (or at least, I’m not familiar enough with the program to know how to solve the problems).

All you have to do is create one ignore (right click, select ‘ignore file’, see above) and Github for Windows will create a gitignore file in your project folder; once you’ve got that, edit that in a text editor (notepad is fine) and copy-paste the contents from Unity.gitignore.

It’s a little frustrating to have to do these extra steps, but it’s definitely worth it. Plus, once you’ve got one .gitignore in a Unity project folder, you can just copy paste that whenever you make a new project.

1 Like

I think that perhaps the difference is the creating of the repository.

I use GitKraken, great tool - free - highly recommend it. I can either go to GitHub and create the repository there, including the .gitignore, then simply clone that locally, or, I can create it locally. In either case the .gitignore file is created first and placed into the repository. It becomes the initial commit and I think that may be all that is missing here. e.g. rather than committing for the first time with all of the files AND the .gitignore, perhaps the first commit should just be the .gitignore.

Little tricky for me to test at this end without the same tools installed, but I think giving that a whirl may be beneficial if Mark has chance.

The Unity.gitignore file Mark has looks good, its the one linked from the course and is actually one hosted on GitHub, so I don’t think the file is the issue.

That’s possibly true for the issue Mark listed when he said the library was committed; I just wanted to put in my piece, because I was having some issues getting a working .gitignore file too until I did the steps I listed.

1 Like

No worries, the more the merrier - and all of the info is bound to prove useful to others :slight_smile:

Hi Both,

Sorry for the delayed response.

I have now had time to try both methods. I could not get the initial commit method working unfortunately Rob, but the method suggested by Whalley does seem to have worked. I now have a working .gitignore file and have tested multiple commits in a new test project to ensure that the right files are being committed.

Rob, I’m sure that now I have a working file I would be able to use the .gitignore initial commit going forward.

Thankyou both for your time and help with this :slight_smile:

Mark

1 Like

Fantastic! Glad to hear it is now resolved and you are moving forwards again.

Nice one Tom (@whalleyrulz) :slight_smile:

Privacy & Terms