zoukankan      html  css  js  c++  java
  • CentOS 6 安装 Git

    1. 安装 Git:

    # yum update    # 1.更新系统
    # yum install curl-devel expat-devel gettext-devel openssl-devel gcc perl-ExtUtils-MakeMaker    # 2.安装依赖包
    # 3.下载最新的 Git 源码并解压缩: https://www.kernel.org/pub/software/scm/git/
    # tar zxvf git-2.9.4.tar.gz
    # cd git-2.9.4
    # make prefix=/usr/local/git all    # 4.编译到指定目录
    # make prefix=/usr/local/git install    # 5.安装到指定目录
    # whereis git    # 6.查看 git 所在的路径
    # vim /etc/profile        # 7.把 git 路径放到环境变量中
    export PATH=/usr/local/git/bin:$PATH    
    # source /etc/profile
    # git --version    # 8.查看 git 版本
    

    2.设置 Git:

    $ pwd
    /home/centos
    $ git config --global user.name "Philly008"    # 设置用户名和 email
    $ git config --global user.email "liuup66@163.com"
    $ ls -a | grep .gitconfig    # 设置完成后会生成 .gitconfig 文件
    $ ssh-keygen -t rsa -C "liuup66@163.com"    # 创建 SSH Key,默认路径即可(一般是 ~/.ssh)
    $ cat ~/.ssh/id_rsa.pub    # 复制此文件内容到 Github>settings>SSH Key>Add SSH key 里面
    $ ssh -T git@github.com    # 测试链接是否成功
    

    3.为 Github 上的 Repository 提交修改:

    $ git clone https://github.com/Philly008/autotest.git
    $ cd ./autotest
    $ vim README.md
    $ git status
    $ git add README.md
    $ git commit -m "Edit by Centos 20170601"
    $ git remote add origin https://github.com/Philly008/autotest.git
    此时会报错:remote origin already exists.
    $ git remote rm origin
    $ git remote add origin https://github.com/Philly008/autotest.git
    $ git push -u origin master    # 提交完成后,查看 Github 上的 Repository 的更改。
    
  • 相关阅读:
    LoRa硬件调试-前导码
    LoRaWAN调试踩坑心得(二)
    LoRaWAN调试踩坑心得(一)
    LoRaWAN_stack移植笔记(七)_数据包的接收发送
    LoRaWAN协议(七)--完整数据流程
    Android Studio Error while executing: am start -n错误解决方案
    Spring系列(八)
    并发工具类简介
    CAS
    多线程基础(一)线程创建
  • 原文地址:https://www.cnblogs.com/liuliu3/p/6931436.html
Copyright © 2011-2022 走看看