How to add an existing Xcode project to git
cd projectfolder/
find . | grep "UserInterfaceState.xcuserstate"
if the file exists add it to the .gitignore file
find . | grep "UserInterfaceState.xcuserstate" > .gitignore
check everything is OK
cat .gitignore
Initialise git
git init
Add all the files to git
git add .
Commit the files to git with a comment to say why
git commit - m "initial commit"
If you have git issues, you may need to install command line tools from Xcode preferences.