.Gitignore file stays in as a text file?

Hello everyone,

I’m fairly new to the Github, Bitbucket… I recently lost all my files because i didn’t know these softwares and now i’m going on a hunt to have it working before I start over!

Anywho, I decided to use Bitbucket (SourceTree) and for some reason when I try to implement the .gitignore file in the unity assests folder Source Tree so it can ignore the Library. The text document does not convert into a GITIGNORE file type as I see in tutorials. Moreover, Source tree doesn’t recognize it…

Here is the code:

/[Ll]ibrary/
/

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

Any advice?

Thanks in advance!!

3012075–224736–gitignore.gitignore.txt (454 Bytes)

the file should be named JUST

.gitignore

no gitignore.gitignore

no .gitignore.txt

and definitely no gitignore.gitignore.txt

If you’re on windows, Windows Explorer probably complains when you try to remove the .txt, because it presumes all files should have an extension and and prefix and it sees .gitignore as a prefixless suffix.

What I do is use a editor like Notepad++, write my .gitignore, and then Save As directly from there.

3 Likes

I did try that and it still doesn’t work…

I edited the post afterward… there’s a follow up:

If you’re on windows, Windows Explorer probably complains when you try to remove the .txt, because it presumes all files should have an extension and and prefix and it sees .gitignore as a prefixless suffix.

What I do is use a editor like Notepad++, write my .gitignore, and then Save As directly from there.

Remember Windows Explorer by default hides extensions… you may want to disable that feature to make 100% you have it named correctly.

2 Likes

Okay so I see now that it still does put it in a .gitignore.txt
Should I just download Notepad ++ or is there a way to fix this?

Notepad itself should also be able to do it.

Is there something you reccomend? It still comes back to .txt or that i need to enter a proper name for it

I’m on Win10 and I just did it.

Open Notepad
Type in what your gitignore should say
File->Save As
named it ‘.gitignore’
Save

File created with correct name.

1 Like

Nvm it actually works! The only files left are assets and project settings!! Thank you so much lordofduct! You are a life saver :smile:

For folks who stumble upon this thread later on: Another way of doing this would be to directly take the .gitignore file from GitHub (gitignore/Unity.gitignore at main · github/gitignore · GitHub)
It will contain a file named “Unity.gitignore” that you can rename to “.gitignore” in Window’s file explorer.
You then need to place it at the root of your Unity project.
Note that no matter which method you choose, if you already commited files that you now want to ignore, you need to tell Git to forget them. You can type git rm -r Library for example.

If you need a bit more detail, I have a blog post about this: Crafty - Unity gitignore essentials