Save to .gitignore in the root directory of a Unity project. See Using Git for Unity Projects for additional details.

.gitignore
# Modified from:
#     https://github.com/github/gitignore/blob/master/Unity.gitignore

/[Ll]ibrary/
/[Uu]serSettings/
[Tt]emp/
[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Mm]emoryCaptures/

# Uncomment this line if you wish to ignore the asset store tools plugin
# [Aa]ssets/AssetStoreTools*

# Visual Studio cache directory
.vs/

# Gradle cache directory
.gradle/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.unitypackage

# Crashlytics generated file
crashlytics-build.properties

# Windows
Thumbs.db
Thumbs.db.meta

# MacOS
*.DS_Store

# VS Code
*.vscode