天天看點

git使用安裝實戰

安裝環境:Windows 

1 安裝msysgit

下載下傳Git-1.7.60preview20110708.exe版本

按預設安裝

2 安裝TotoiseGit

<a href="http://code.google.com/p/tortoisegit/downloads/list">http://code.google.com/p/tortoisegit/downloads/list</a>

下載下傳 最新版本,并安裝

3 設定個人資訊

開始--所有程式--TotoiseGet--Setting

Git--config

填寫UserInfo的Name和Email

4 基本的TotoiseGit使用和TotoiseSVN一樣

建議試試下載下傳

git://github.com/antirez/redis.git

這個代碼來試試

5 建立GitHub賬号:

<a href="https://github.com/">https://github.com/</a>

GitHub可以托管各種git庫,并提供一個web界面,功能和google-code差不多

6 建立SSH Key,并增加SSH Key

建立:

ssh-keygen -t rsa -C "[email protected]"

按照提示一步步走,直到提示:

Your public key has been saved in /c/….

增加ssh key

On the GitHub site Click “Account Settings” &gt; Click “SSH Public Keys” &gt; Click “Add another public key”

在key這個字段中填寫

id_rsa.pub檔案中的内容

id_rsa.pub目錄是在剛剛存放的.ssh目錄(這是個隐藏目錄)中

測試是否已經安裝完成了

ssh -T [email protected] to ssh to github

7建立個人資訊

其中的user和token是你在github上的使用者名和token

8 建立Repo

填寫需要填寫的字段

送出後進入新頁面

按照提示建立一個測試gitrepro

mkdir testgithub

  cd testgithub

  git init

  touch README

  git add README

  git commit -m 'first commit'           //git送出

  git remote add origin [email protected]:jianfengye/testgithub.git   //在github上增加一個Repo

  git push -u origin master    //将檔案上傳

9 建立一個項目的分支

以Spoon-Knife為例子

git clone [email protected]:username/Spoon-Knife.git   //複制這個項目

$ cd Spoon-Knife

$ git remote add upstream git://github.com/octocat/Spoon-Knife.git  //加入分支upstream

$ git fetch upstream  //擷取分支upstream

$ git push origin master  //上傳本地檔案

本文轉自軒脈刃部落格園部落格,原文連結:http://www.cnblogs.com/yjf512/archive/2012/02/22/2362992.html,如需轉載請自行聯系原作者