zoukankan      html  css  js  c++  java
  • Git学习系列之Windows上安装Git详细步骤(图文详解)

    前言

      最初,Git是用于Linux下的内核代码管理。因为其非常好用,目前,已经被成功移植到Mac和Windows操作系统下。

      鉴于大部分使用者使用的是Windows操作系统,故,这里详细讲解Windows操作系统下Git的安装步骤。

           当然我也会陆续写出Linux和Mac操作系统下Git的安装步骤。

    安装前的说明

        Git在windows平台上安装说明。

             Git 是 Linux Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制软件。目前Git已经可以在windows下使用,主要方法有二:msysgit和Cygwin。Cygwin和Linux使用方法类似,Windows版本的Git提供了友好的GUI(图形界面),安装后很快可以上手,此处我们主要讨论基于msysgit的Git安装和使用。

             TortoiseGit是TortoiseSVN的Git版本,TortoiseGit用于迁移TortoiseSVN到TortoiseGit。一直以来Git在Windows平台没有好用GUI客户端,现在TortoiseGit的出现给Windows开发者带来福音。我们将在64位win7操作系统上安装Git,并使用GUI界面,则需同时安装msysGit和TortoiseGit。

    安装步骤

      1. 安装包下载

      安装包的下载,常用的有两种方式

      (1). 百度直接搜索关键词“Git”,在弹出的结果中,通过百度软件中心下载,截图如下所示。这种方法有一个缺点,就是安装包不是最新的。如果图省事的话,可以采取这种方法。

      (2). 官网下载。网址为:https://git-scm.com/download。截图如下所示。点击“Downloads for Windows”按钮,便可跳转到下载链接,完成下载。

     

     

     

     

      2. Git安装

      这里,我以Git 2.8.1 版本安装包为例,进行安装步骤讲解。(因为这一版本是目前公司里用的最多的稳定版本)

      1. 双击安装包。截图如下所示。

      点击下一步。

     

      3、配置安装组件

      默认即可,点击“Next。默认已经都帮我们否选上了。包括创建桌面快捷方式、Git Bash、Git GUi、已经目录和后缀关联等。

     

      可勾选:On the Desktop,这样,会自动在桌面生成Git的快捷方式。

      可不勾选:Git GUI Here。目前,我都是使用Git Bash来进行操作。使用Git GUI,确实可以得到更好的UI体验,不过,个人认为会减低效率。并且,初学者,还是先搞懂Git的常用指令,之后,再使用Git GUI才会有更好的理解。

     

       在“Adjusting your PATH environment”选项中,默认即可。点击“Next”。
      这个步骤最好选择第二项“Use Git from the Windows Command Prompt”, 这样在Windows的命令行cmd中也可以运行git命令了。这样会对以后的一些操作带来方便。

     

     

      配置行结束标记,保持默认“Checkout Windows-style, commit Unix-style line endings”。

     

     

    在终端模拟器选择页面,默认即可,配置后Git Gash的终端比较易用。然后点击“Next”。

     

    最后配置Git额外选择默认即可。然后点击“Install”开始安装。如果之前安装过旧版本,会先卸载然后再安装新版本。

     

    安装完成,默认点"Finish"即可。这样会在浏览器打开新版本的信息。

     

      安装Git完成之后,会在桌面创建Git Bash快捷方式,在任意目录下右击鼠标可以找打Git Bash Here的选项。打开Git客户端界面,输入git。

     

     

    lenovo@LAPTOP-LG72BB3R MINGW64 /
    $ git
    usage: git [--version] [--help] [-C <path>] [-c name=value]
               [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
               [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
               [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
               <command> [<args>]
    
    These are common Git commands used in various situations:
    
    start a working area (see also: git help tutorial)
       clone      Clone a repository into a new directory
       init       Create an empty Git repository or reinitialize an existing one
    
    work on the current change (see also: git help everyday)
       add        Add file contents to the index
       mv         Move or rename a file, a directory, or a symlink
       reset      Reset current HEAD to the specified state
       rm         Remove files from the working tree and from the index
    
    examine the history and state (see also: git help revisions)
       bisect     Use binary search to find the commit that introduced a bug
       grep       Print lines matching a pattern
       log        Show commit logs
       show       Show various types of objects
       status     Show the working tree status
    
    grow, mark and tweak your common history
       branch     List, create, or delete branches
       checkout   Switch branches or restore working tree files
       commit     Record changes to the repository
       diff       Show changes between commits, commit and working tree, etc
       merge      Join two or more development histories together
       rebase     Reapply commits on top of another base tip
       tag        Create, list, delete or verify a tag object signed with GPG
    
    collaborate (see also: git help workflows)
       fetch      Download objects and refs from another repository
       pull       Fetch from and integrate with another repository or a local branch
       push       Update remote refs along with associated objects
    
    'git help -a' and 'git help -g' list available subcommands and some
    concept guides. See 'git help <command>' or 'git help <concept>'
    to read about a specific subcommand or concept.
    
    lenovo@LAPTOP-LG72BB3R MINGW64 /
    $ pwd
    /
    
    lenovo@LAPTOP-LG72BB3R MINGW64 /
    $ ls
    bin/  cmd/  dev/  etc/  git-bash.exe*  git-cmd.exe*  LICENSE.txt  mingw64/  proc/  ReleaseNotes.html  tmp/  unins000.dat  unins000.exe*  unins000.msg  usr/
    
    lenovo@LAPTOP-LG72BB3R MINGW64 /
    $

      我们可以开始学习Git了。

       如果按照前面的步骤安装下来,那么 git 程序所在的路径已经添加到系统 PATH 中(path就相当于系统自动查找路径列表),所以可以直接在任意路径的 cmd 下执行 git 命令。 如果没有添加,则需要 cd 切换到Git所在的 bin 目录下,才能执行 git 命令。

    Git学习系列之Windows上安装Git之后的一些配置(图文详解)

     

      扩展

    Git学习系列之Debian或Ubuntu上安装Git详细步骤(图文详解)

    Git学习系列之CentOS上安装Git详细步骤(图文详解)

    欢迎大家,加入我的微信公众号:大数据躺过的坑        人工智能躺过的坑
     
     
     

    同时,大家可以关注我的个人博客

       http://www.cnblogs.com/zlslch/   和     http://www.cnblogs.com/lchzls/      http://www.cnblogs.com/sunnyDream/   

       详情请见:http://www.cnblogs.com/zlslch/p/7473861.html

      人生苦短,我愿分享。本公众号将秉持活到老学到老学习无休止的交流分享开源精神,汇聚于互联网和个人学习工作的精华干货知识,一切来于互联网,反馈回互联网。
      目前研究领域:大数据、机器学习、深度学习、人工智能、数据挖掘、数据分析。 语言涉及:Java、Scala、Python、Shell、Linux等 。同时还涉及平常所使用的手机、电脑和互联网上的使用技巧、问题和实用软件。 只要你一直关注和呆在群里,每天必须有收获

          对应本平台的讨论和答疑QQ群:大数据和人工智能躺过的坑(总群)(161156071) 

     

     


  • 相关阅读:
    053587
    053586
    053585
    053584
    053583
    053582
    053581
    053580
    053579
    053578
  • 原文地址:https://www.cnblogs.com/zlslch/p/7985285.html
Copyright © 2011-2022 走看看