Pages

2012/10/04

How to using Git repository on Dropbox to back up XCode Project?

This article teaches how to using Git repository on Dropbox to back up XCode Project. Step1:Create XCode project and allowed it to set up a local Git Repository. Step2:Open a console and chdir to the XCode project directory.
$cd ~/MyProject/NewProject1

Step3:Clone a git repository to the Dropbox directory. That is the .git directory in the NewProject1.We do not want the whole working code sync with Dropbox.
$git clone --bare . ~/Dropbox/git/repo/NewProject1.git

Step4:Create a remote git repository. XCode will recognize this remote repo.
$git remote add NewProject1 ~/Dropbox/git/repo/NewProject1.git

Step5:Add Git .gitignore file to the project directory.
# .gitignore file for Xcode4 / OS X Source projects
# Xcode
.DS_Store
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
*.xcworkspace
!default.xcworkspace
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
# Generated
*.o
*.pyc 


Step6:Now we can use this remote git repository in the XCode.Open the NewProject1 project in the XCode. Go to the menubar, File->Source Control->Push. Now you can find the remote repository.

1 comment: