MAC 下 Git的安装与基本配置

编程技术  /  houtizong 发布于 3年前   119
  • 下载git版本源码:(前提是安装了xcode)
    http://kernel.org/pub/software/scm/git/
  • 解压下载在安装包:
    tar xjvf git-1.8.4
     
  • 编译  cd git-1.8.4
    ./configure --prefix=/usr/localmake
     
  • 安装
    sudo make install
     
  • 检查安装git的版本
    git --version
     
  • 查看git的安装路径
    which git
     
  • 设置SSH
    //检查SSH key   cd ~/.ssh//备份已有的key  mkdir key_backupmv id_rsa*key_backup
  • 生成SSH key 
    ssh-keygen -t rsa -C [email protected]//备注:后面的邮箱为注册github账号的邮箱
       运行之后,生成SSH key
    Generating public/private rsa key pair.         Enter file in which to save the key (/Users/chenyue123/.ssh/id_rsa):          Enter passphrase (empty for no passphrase):            Enter same passphrase again:         Your identification has been saved in yes.         Your public key has been saved in id_rsa.pub.         The key fingerprint is:         fb:c4:b0:e0:47:fd:be:e0:fb:ea:73:ef:a8:29:d5:22 [email protected]         The key's randomart image is:+--[ RSA 2048]----+|                 ||                 ||                 ||         .       ||      . S ..     ||     . oE=o..    ||      . +o+..    ||       ..+.+..   ||         oOB=+o  |+-----------------+
     
  •  将SSH key添加到GitHub

     

       登录到GitHub页面,找到

    Account Settings->SSH Public Keys->Add another key
        将生成的key(id_rsa.pub文件)内容copy到输入框中,save。

     

  •  测试链接
    ssh [email protected]
     运行结果显示
    The authenticity of host 'github.com (207.97.227.239)' can't be       established.    RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.    Are you sure you want to continue connecting (yes/no)? yes    PTY allocation request failed on channel 0    Hi chenyue123! You've successfully authenticated, but GitHub does not provide shell access.         Connection to github.com closed.
     
  • 设置个人信息
    //设置github默认用户名git config --global user.name "chenyue123"//设置github默认用户邮箱git config --global user.email "[email protected]"
  • 开启终端输入git命令时显示颜色
    git config --global color.ui true
  • 查看git默认的用户名和邮箱 
    //查看git的默认用户名git config user.name//查看git的默认邮箱git config user.email
     
    //打印结果分别为//用户名chenyue123//邮箱[email protected]

请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!

留言需要登陆哦

技术博客集 - 网站简介:
前后端技术:
后端基于Hyperf2.1框架开发,前端使用Bootstrap可视化布局系统生成

网站主要作用:
1.编程技术分享及讨论交流,内置聊天系统;
2.测试交流框架问题,比如:Hyperf、Laravel、TP、beego;
3.本站数据是基于大数据采集等爬虫技术为基础助力分享知识,如有侵权请发邮件到站长邮箱,站长会尽快处理;
4.站长邮箱:[email protected];

      订阅博客周刊 去订阅

文章归档

文章标签

友情链接

Auther ·HouTiZong
侯体宗的博客
© 2020 zongscan.com
版权所有ICP证 : 粤ICP备20027696号
PHP交流群 也可以扫右边的二维码
侯体宗的博客