Xcode串連git@osc,xcodegit@osc

來源:互聯網
上載者:User

Xcode串連git@osc,xcodegit@osc
一般按照這篇文章去做,應該可以成功 Xcode串連git@osc :http://my.oschina.net/zxs/blog/142544但最近特別惱火,在osc裡建立了個項目,老是串連錯誤,經過幾小時的搜尋,最終還是搭建成功,特此記錄下!接下來還是按照這篇部落格步奏去走:

第一步:成生SSH密鑰

開啟終端命令工具,輸入命令:ssh-keygen -t rsa -C "diaosi@gmail.com"

注意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 git@git.oschina.net,螢幕輸出:

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 init 【需要初始化,error:fatal: Not a git repository (or any of the parent directories): .git】

輸入命令:git remote add origin git@git.oschina.net:heqings/fitness.git // /這個相當於指定本地庫與github上的哪個項目相連

輸入命令:rm -fr ~/.ssh/known_hosts【清空檔案裡的內容:rm -fr /目錄名/*】

輸入命令:git add -A 【添加整個項目】

輸入命令:git commit -m "添加整個項目"

// 不進行上面兩步,會拋出error: src refspec master does not match any.

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

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

這裡即可完成提交!





git init 產生的目錄解釋error: src refspec master does not match any.
引起該錯誤的原因是,目錄中沒有檔案,空目錄是不能提交上去的

error: insufficient permission for adding an object to repository database ./objects
服務端沒有可寫目錄的許可權

錯誤提示:fatal: remote origin already exists.
解決辦法:$ git remote rm origin
錯誤提示:error: failed to push som refs to ........
解決辦法:$ git pull origin master //先pull 下來 再push 上去

git init //在當前項目工程下履行這個號令相當於把當前項目git化,變身!


git add .//把當前目次下代碼參加git的跟蹤中,意思就是交給git經管,提交到本地庫


git add <file> //把當前檔案參加的git的跟蹤中,交給git經管,提交到本地庫


git commit -m “…”//相當於寫點提交資訊


git remote add origin git@github.com:ellocc/gittest.git //這個相當於指定本地庫與github上的哪個項目相連


git push -u origin master //將本地庫提交到github上。


git clone git@github.com:ellocc/gittest.git  //將github上的項目down下來。


git fetch origin //取得長途更新,這裡可以看做是籌辦要取了


git merge origin/master //把更新的內容歸併到本地分支/master


下面是刪除檔案後的提交


git status //可以看到我們刪除的哪些檔案


git add .   //刪除之後的檔案提交git經管。


git rm a.c //刪除檔案


git rm -r gittest //刪除目次

 

git reset --hard HEAD 復原到add之前的狀態
git diff比較的是跟蹤列表中的檔案和檔案系統中檔案的差別


xcode 怎與iPod touch 串連

插上,自動識別
 
下載速度快的蘋果Xcode串連

如果下破解版的xcode,需要再破解macbook嗎? 主流支援語言有 C C++ 正版從AppStore下載5美元你在網上下的安裝包可以直接安裝,不用破解,這東西
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.