Xcode のプロジェクトを GitHub にアップロード

新しいリポジトリGitHub で作成
1.GitHub 最初のページの右側にある「New repository」をクリック

2.「Project Name」に既に作ってある Xcode のプロジェクトの名前を入力して「Create Repository」をクリック
この例では「DocInteractionTest」というリポジトリを作成しています。

3.リポジトリが出来た!

でもまだリポジトリの中身は empty!


既にある Xcode のプロジェクトを Git で管理開始
1.ターミナルで既にある Xcode のプロジェクトのフォルダに行って「git init」する
この例では「DocInteractionTest」が既にあるプロジェクト名。

iMac-i3-27:~ paraches$ cd /Users/paraches/Desktop/GitHubTest/DocInteractionBase/DocInteractionTest 
iMac-i3-27:DocInteractionTest paraches$ ls
DocInteractionTest		DocInteractionTest.xcodeproj
iMac-i3-27:DocInteractionTest paraches$ git init
Reinitialized existing Git repository in /Users/paraches/Desktop/GitHubTest/DocInteractionBase/DocInteractionTest/.git/

ん? なんか変だけど…。もしかしたら Xcode で Source Control するようになってたのかな? ま、いっか…。


2.README 作るとそれがリポジトリの説明文になるみたいなので作っておく
けど、これじゃ中身がないから意味ないけど…。別に作らなくても OK。

iMac-i3-27:DocInteractionTest paraches$ touch README

次にリポジトリに DocInteractionTest フォルダの中身を加えてコミットする。

iMac-i3-27:DocInteractionTest paraches$ git add .
iMac-i3-27:DocInteractionTest paraches$ git commit -m 'first commit'
[master b5b032b] first commit
 10 files changed, 250 insertions(+), 12 deletions(-)
 create mode 100644 DocInteractionTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
 create mode 100644 DocInteractionTest.xcodeproj/project.xcworkspace/xcuserdata/paraches.xcuserdatad/UserInterfaceState.xcuserstate
 create mode 100644 DocInteractionTest.xcodeproj/xcuserdata/paraches.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
 create mode 100644 DocInteractionTest.xcodeproj/xcuserdata/paraches.xcuserdatad/xcschemes/DocInteractionTest.xcscheme
 create mode 100644 DocInteractionTest.xcodeproj/xcuserdata/paraches.xcuserdatad/xcschemes/xcschememanagement.plist
 create mode 100644 DocInteractionTest/myPic.JPG
 create mode 100644 README
iMac-i3-27:DocInteractionTest paraches$ git push origin master

次は DocInteractionTest のリポジトリGitHub に加える(push する)。
これ、GitHub のヘルプのコマンドと違うけど、こっちはさっき GitHubリポジトリを作った時に表示されたもの。たぶんヘルプは古くてこっちが新しいんだろうと思ってこっちのコマンドにしている。

iMac-i3-27:DocInteractionTest paraches$ git remote add origin git@github.com:paraches/DocInteractionTest.git
iMac-i3-27:DocInteractionTest paraches$ git push -u origin master
Counting objects: 38, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (33/33), done.
Writing objects: 100% (38/38), 331.84 KiB, done.
Total 38 (delta 7), reused 0 (delta 0)
To git@github.com:paraches/DocInteractionTest.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.
iMac-i3-27:DocInteractionTest paraches$ 

なにやらちょっと時間がかかって終了。

GitHub を見てみるとちゃんとアップロードされてる!

でも、xcodeproj がフォルダになっちゃうのは気持ちが悪いな…。(これパッケージファイルとして表示させられないのかな?)


以上で一通りの手順は終了。