Creating git repo for Unreal project

What to add to the git repo?

You need to add the .uproject file, Content, Config, Source and Build folders (in build folder we only took .ico). VS project files can be created from project file or updated in File>Resfresh Visual Studio Project

Explained here. Git manual here.

Creating a new repository

* install git http://git-scm.com/
* open git bash and goto project folder. in project folder do:

git init

Adding files

First, trying the UE way:

* in UE File>Connect to source control, choose git. That works.
* File>Submit to source control. It selects all Content and Config files (but not the others).

It takes a lot of time and returns some errors, namely it looks like it tries to add some engine assets.

Seems that nothing was added.

Trying the command line:

git add Content/\*.uasset
git add Content/\*.umap
git add Config/\*.ini
git add Build/\*.ico
git add Source
git add CrazyRestorant.uproject

also adding various pictures and maya models:

git add Import

Now committing:

git commit -m "initial commit"

Took some time but seems it works.

Opening UE. Source control icon button is green. Trying “Submit to source control…”. Nothing to add.
So far so good.

Test cloning new repo:

cd..
mkdir gittest
cd gittest
git clone ../CrazyRestorant

That worked.

Opening project, building source. Works.

Click on .uproject > Generate Visual Studio project

Open .sln

Works.