1、项目根目录新建.gitignore文件
/[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 filesExportedObj/.consulo/*.csproj*.unityproj*.sln*.suo*.tmp*.user*.userprefs*.pidb*.booproj*.svd*.pdb# Unity3D generated meta files*.pidb.meta# Unity3D Generated File On Crash Reportssysinfo.txt# Builds*.apk*.unitypackage
2、项目根目录新建.gitattributes文件
* text=auto# keep lf on unity files*.asset text eol=lf*.meta text eol=lf*.prefab text eol=lf*.unity text eol=lf
3、Unity工程设置
Edit -> Project Settings -> Editor1. Version Control - 设置为 Visible Meta Files2. Asset Serialization - 设置为 Force Text
4、git init 。。。add 。。