Xcode串連git@osc (oschina git代碼託管)

來源:互聯網
上載者:User

標籤:

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 diaosi@gmail.com

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 diaosi@gmail.com

第五步:設定項目

擷取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按鈕即可。

Xcode串連[email protected] (oschina git代碼託管)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.