代码改变世界

git使用安装实战

2012-02-22 13:37  轩脉刃  阅读(769)  评论(0编辑  收藏  举报

安装环境:Windows 

     

    1 安装msysgit

    进入到http://code.google.com/p/msysgit/

    下载Git-1.7.60preview20110708.exe版本

     

    按默认安装

     

    2 安装TotoiseGit

    http://code.google.com/p/tortoisegit/downloads/list

    下载 最新版本,并安装

     

    3 设置个人信息

    开始--所有程序--TotoiseGet--Setting

    Git--config

    填写UserInfoNameEmail

     

    4 基本的TotoiseGit使用和TotoiseSVN一样

    建议试试下载

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

    这个代码来试试

     


     

     

    5 创建GitHub账号:

    https://github.com/

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

     

    以下步骤参考http://help.github.com/win-set-up-git/

     

    6 创建SSH Key,并增加SSH Key

     

    创建:

    ssh-keygen -t rsa -C "your_email@youremail.com"

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

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

     

    增加ssh key

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

     

    key这个字段中填写

    id_rsa.pub文件中的内容

    id_rsa.pub目录是在刚刚存放的.ssh目录(这是个隐藏目录)中

     

    测试是否已经安装完成了

    ssh -T git@github.comAttempts to ssh to github

     

    7建立个人信息


    其中的usertoken是你在github上的用户名和token

     

    8 创建Repo

    进入:https://github.com/repositories/new

    填写需要填写的字段

     

    提交后进入新页面

    按照提示创建一个测试gitrepro

    mkdir testgithub

      cd testgithub

      git init

      touch README

      git add README

      git commit -m 'first commit'           //git提交

      git remote add origin git@github.com:jianfengye/testgithub.git   //github上增加一个Repo

      git push -u origin master    //将文件上传
     

    9 创建一个项目的分支

    Spoon-Knife为例子

    git clone git@github.com: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://help.github.com/

    http://baike.baidu.com/view/3366456.html?fromTaglist

    http://code.google.com/p/tortoisegit/downloads/list

    http://wenku.baidu.com/view/730e56896529647d2728520d.html?from=related&hasrec=1


    ---------------------- 

作者:yjf512(轩脉刃)

出处:http://www.cnblogs.com/yjf512/

本文版权归yjf512和cnBlog共有,欢迎转载,但未经作者同意必须保留此段声明