xcode集成git

轉自:http://my.oschina.net/zxs/blog/142544
Xcode 已經集成了git,建立新項目時鉤選使用git,然後按照下面步驟讓Xcode和git@osc 建立連接。

第一步:成生SSH密鑰

打開終端命令工具,輸入命令:ssh-keygen -t rsa -C “[email protected]

注意ssh-keygen沒有空格。屏幕輸出:

Generating public/private rsa key pair.

Enter file in which to save the key (/Users/diaosi/.ssh/id_rsa):diaosi

在上方輸入生成的密鑰文件名,如diaosi,屏幕輸出:

Enter passphrase (empty for no passphrase): 輸入密碼

Enter same passphrase again: 確認密碼

Your identification has been saved in diaosi.

Your public key has been saved in diaosi.pub.

The key fingerprint is:

25:fd:01:00:89:98:49:bf:2e:ac:32:2e:d2:5d:bf:98 [email protected]

The key’s randomart image is:

+–[ RSA 2048]—-+

| ..+ ..o… |

| +.. . . . |

| . . o . |

| . o . . |

| . S . |

| . . . |

| .o… . |

|=…. o. |

|*o E .. |

+—————–+

屏幕提示生成密鑰文件成功,保存在/Users/diaosi文件夾下。

第二步:把diaosi.pub中的內容加入git@osc 的SSH密鑰中

第三步:添加SSH並連接

輸入命令:ssh-add ~/diaosi

~/diaosi 是剛剛生成的密鑰文件路徑,屏幕輸出:

Enter passphrase for /Users/diaosi/diaosi:輸入密碼

Identity added: /Users/diaosi /diaosi (/Users/diaosi /diaosi)

輸入命令ssh -T [email protected],屏幕輸出:

The authenticity of host ‘git.oschina.net (58.215.179.44)’ can’t be established.

RSA key fingerprint is 14:b8:b8:0b:c2:b2:5e:ae:f2:21:f8:18:4d:3a:be:fc.

Are you sure you want to continue connecting (yes/no)? yes(輸入yes),屏幕輸出:

Warning: Permanently added ‘git.oschina.net,58.215.179.44’ (RSA) to the list of known hosts.

Welcome to Git@OSC , 老左!

第四步:設置個人信息

輸入命令:

git config –global user.name “diaosi”

git config –global user.email [email protected]

第五步:設置項目

獲取git@osc 上的項目路徑。

輸入命令:cd 項目文件夾

輸入命令:git remote add origin [email protected]:heqings/fitness.git

輸入命令:git pull -u origin master //從git@osc 上拉取項目

輸入命令:git push -u origin master //提交項目

第六步:Xcode集成

在Xcode中,提交代碼到git@osc 前需提交到本地git,否則Xcode會提示你。

在項目或文件上選擇文件提交到本地,這裏需要注意的是,工程用戶數據不要提交到git,因它實時在變化,本地和遠程都不要提交,否則Push時提示有文件未提交。

以上文件不要提交。

把項目提交到本地:

File->Source Control->Commit

把項目提交到git@osc :

File->Source Control->Push

點擊Push按鈕即可

發佈了96 篇原創文章 · 獲贊 86 · 訪問量 96萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章