码迷,mamicode.com
首页 > 其他好文 > 详细

Begin using git (Part1) - Git的安装与配置

时间:2015-10-21 00:08:03      阅读:266      评论:0      收藏:0      [点我收藏+]

标签:

Git提供了适用于Linux, Windows, OSX的客户端, 本节以Windows为例介绍基本安装与配置。

所需工具:msysgit, kdiff3.

在Windows Explorer任意目录下,右键菜单选择Git bash here,进入Git command prompt.

配置身份信息:

$ git config --global user.name "John Doe"

$ git config --global user.email johndoe@example.com

配置合并工具:

$ git config --global merge.tool kdiff

$ git config --global mergetool.kdiff3.path "your path to kdiff3.exe"

根据提示配置ssh:

  • 检查是否已配置SSH, 如果已经配置,下述命令将会返回类似id_rsa, id_rsa.pub的数个文件。

    $ ls ~/.ssh

  • 生成public/private key。根据提示跳过密码可以留空。

      $ ssh-keygen -t rsa -b 4096 -C "your-email@example.com"

  • 确保ssh-agent打开。

      $ ssh-agent -s

  • 添加private key到ssh-agent。

    $ ssh-add ~/.ssh/id_rsa

  • 拷贝public key至剪贴板,并粘贴进Remote server profile中。

        $ clip < ~/.ssh/id_rsa.pub

    例如在github中可以在profile->personal settings中可以找到 SSH Keys菜单:

     技术分享

 

至此基本配置完成,可以使用预配置的身份clone仓库,提交代码,以及更多。

 

Begin using git (Part1) - Git的安装与配置

标签:

原文地址:http://www.cnblogs.com/500error/p/begin-using-git-part-1.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!