设置SSH并绑定到github:https://help.github.com/articles/generating-ssh-keys

XcodeSetup

CreateanewprojectinXCode(DONOTselectthelocalgitrepository/sourcecontroloption,wewilldothismanually).

CloseXCode(important!).

LocalGitSetup

Browsetotheprojectpathwherethe.xcodeprojfileis.

Executethefollowingfromyourcommandline:

git init
git add .
git commit -m 'Initial commit from local git'
git remote add origin [email protected]:ACCOUNT/PROJECT.git
git pull origin master
(VIM editor opens)
Hit 'i' to add a comment, for example 'Initial merge to sync local git with remote git'. 
Hit 'ESC'.
Hit 'ZZ'.
(VIM editor closes)
git push origin master

Ifyouchangeanycodeintheproject,youneedtoexecutebelowcommandagainoryouwillget"Changesnotstagedforcommit"warning.

git add .

myaccountmarkwangen