As I’m going to build an iPad prototype for my graduation project and like to have it open source, I decided to go for GitHub (Online project hosting using Git. Includes source-code browser, in-line editing, wikis, and ticketing. Free for public open-source code.) since I have good experience with this service during my Ruby on Rails developments and it’s now implemented in Xcode 4. However, the implementation is fairly buggy to work with a remote repository. There are two guides I found to set the repository up, but both didn’t work completely, so here’s my version which worked fine.
- Open Xcode
- Create a new Xcode project. In the dialogue for source control make sure the local git repository is checked and will be created
- Quit Xcode (command+Q)
- Go to GitHub.com (create a user, if you don't have one yet) and create a new repository
- Open your Terminal.app, go to the project folder ("cd ~/YourDevelopments/YourProject" and follow the GitHub Global setup:
- git config --global user.name "Your Name"
- git config --global user.email firstname.lastname@example.org
- Follow the "Existing Git repo?" steps:
- git remote add origin email@example.com:yourGitHubusername/yourGitHubProject.git
- git push -u origin master
- Go back to GitHub and click "continue"
- Your source data should be uploaded there and listed with the message "Initial Commit"
- Open your Xcode project
- After changing some files (f.e. changing from iPhone to iPad app) go to File->Source Control->Commit and write a short info/documentation of what you did (f.e. "Changed to iPad App"). Make sure all items are ticked in the left browser and press "Commit"
- Go to File->Source Control->Push. There will be an error, that your username is not correct, just ignore that. Go to File->Source Control->Push again and press "Push". There will be an error saying the push was not successful, ignore that too and Push again (File->Source Control->Push, "Push". You should get a message that there are no uncommitted changes in the project
- Check the repository on GitHub, it should show the changes now
This is of course extremely buggy and not “the apple way”, but I guess the next implementation will be more stable.
References: http://lists.apple.com/archives/xcode-users/2011/Mar/msg00616.html http://lists.apple.com/archives/xcode-users/2011/Mar/msg00617.html http://peterszwach.blogspot.com/2011/03/github-xcode-4.html