Apple’s Xcode has integrated with Git tool, a distributed revision control and source code management (SCM) system with an emphasis on speed. It allows developers to control the progress of projects very easily. You could also push your projects to some free web-based hosting service like Github with few button pressed.

However, there is another workaround to push your project to Github – using your local terminal.

1.Setting up Git repository in your local project.

You could either create the git repository when you are creating the project in Xcode.

xcode-git

Or create it in terminal.

1
2
git init
Initialized empty Git repository in /Users/Username/SKDemo/.git/

2.Commit your project

When you finished current progress of the project, you will have to commit the modification to the repository.

1
2
3
git commit -m "Add project"
[master f187eaa] Add project, nothing changed
2 files changed, 3 insertions(+), 3 deletions(-)

3.Push your project to Github

First you need to create a git repository for you project on Github. Get the HTTPS clone URL on the right-bottom corner of you newly-created repository page. Make sure it is HTTPS.

Then add the remote repository. Go back to your terminal and type:

1
git remote add origin https://github.com/artekr/SKDemo.git

Check if you succeed or not:

1
2
3
git remote -v
origin https://github.com/artekr/SKDemo.git (fetch)
origin https://github.com/artekr/SKDemo.git (push)

If you could see the above address of your remote repository, you are ready to push your project to Github.

1
2
3
4
5
6
7
8
git push origin master
Counting objects: 21, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (13/13), 1.66 KiB | 0 bytes/s, done.
Total 13 (delta 4), reused 0 (delta 0)
To https://github.com/artekr/SKDemo.git
57df96b..1f7265f master -> master

Got to your Github page and voila:
SKDemo-github