Here is a checklist for setting up git for Xcode projects on a Mac.
1- install
Install Git from git-osx-installer
Install Gitx from gitx
Launch Gitx and invoke Enable Terminal Usage form Preferences
Read up the git basics
2- set up git for an Xcode project :
cd <projectdir>
git init
This creates the subdirectory .git
git status
Create file .gitignore :
#see http://shanesbrain.net/2008/7/9/using-xcode-with-git
# xcode noise
build/*
*.xcclassmodel/*
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
# old skool
.svn
# osx noise
.DS_Store
profile
Create file .gitattributes :
#see http://shanesbrain.net/2008/7/9/using-xcode-with-git
*.pbxproj -crlf -diff -merge
We could continue in Terminal using git commands (add, commit)
but we can now launch Gitx from Terminal :
gitx
This opens the GUI view on files to be added and comitted – see the gitx documentation for details.
Use gitx to add all Xcode files in the project and to commit them.
3- create a remote repository at ProjectLocker
Sign up at ProjectLocker for a free account (git)
Generate a public key with
ssh-keygen -t dsa
and paste it to ProjectLocker when requested.
ProjectLocker will provide a Git Location similar to git-your_user_name@free2.projectlocker.com:your_first_project_name.git
Back in Terminal in the Xcode project directory, tell git about the remote location, then pull the (for now empty) remote repository, and finally push the local repository :
git remote add origin git-your_user_name@free2.projectlocker.com:your_first_project_name.git
git pull origin master
git push origin master
Now the remote repository should contain a copy of the local repository.
4- add projects to the ProjectLocker (PL) repository
You need to create a PL project for each local git project that you want to replicate to the PL.
You log in to PL and Add Project … very simple.
Just don’t forget to add yourself as User to the newly created project, otherwise you won’t have the access to it from your local terminal via git.