git使用笔记

1.到官网下载git工具:https://git-scm.com/downloads 【yum remove git (安装前先卸载旧版本)】

2.安装完成后配置:

1 git config --global user.name "your name"
2 git config --global user.email "your email"

一、创建本地仓库

  1. 在D盘下右键点击 Git Bash Here
  2. 创建仓库目录
    mkdir git_zuihou
  3. 初始化仓库
    cd git_zuihou
    git init

     

二、联系远程仓库

  1. 在github上建立一个仓库或者在linux上搭建一个git服务器(现在还是在git_zuihou文件夹下)
  2. git remote add origin https://github.com/zhouyangsheng188/git_demo.git

    创建第一个文件README.md

    1 vim README.md //在里面随便写点什么
    2 git add README.md //提交到远程仓库前一定要先使用git add将文件提交到缓存区
    3 git commit -m '文件名' //这一步还未上传
    4 git push -u origin master //执行这一步后,远程仓库就会出现你要提交的文件

三、获取远程仓库的工作目录

            1 git clone https://github.com/zhouyangsheng188/git_demo.git 

四、更新git版本(centos)

  1. 下载最新的git 并安装
  2. 1.wget https://www.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz  //下载最新版本git
    2.tar xzf git-2.9.5.tar.gz  //解压
    3.cd git-2.9.5
    4.make prefix=/usr/local/git all
    5.make prefix=/usr/local/git install
    6.echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
    7.source /etc/bashrc

    查看git版本:git --version

  3. 安装git时出现错误:make: *** [git-credential-store] Error 1
  4. 回到src
    wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
    tar xzf libiconv-1.14.tar.gz
    ./configure --prefix=/soft/lib/libiconv-1.14
    make
    make install
    回到git-2.9.5
    make configure
    ./configure prefix=/usr/local --with-iconv=/soft/lib/libiconv-1.14
    再执行1.4步

     yum remove git (安装前先卸载旧版本)

 参考:http://blog.csdn.net/javyzheng/article/details/50311175#使用git工作的一般流程

posted @ 2018-01-25 13:04  熊猫眼丶  阅读(116)  评论(0编辑  收藏  举报