Using Git with an existing Xcode project

AndyD273 picture AndyD273 · Mar 21, 2011 · Viewed 92.3k times · Source

I am trying to figure out how to use git in my project workflow, and I have an existing Xcode project that I want to put into the repository. I think I have the repository set up correctly under organizer, but the Source Control menu is grayed out.
Apparently, it's easy to do if you start a new project, but how do I import an existing project with snapshots and everything?

I'm using Xcode 4 and git 1.7.4

Also, if there are any good walkthroughs on git configuration and best practices, that would be nice. I'm a little late to the game, so anything that can get me up to speed would be cool.

Answer

MCannon picture MCannon · Mar 21, 2011

GitHub has some very good git tutorials at help.github.com.

to do the initial setup of a repository, open up a terminal window, and CD to the project directory. once there, type

git init
git add .
git commit -m "Initial commit"

Restart Xcode. The repository should now be set up, and you will be able to manage it in xcode 4.