Git - installation configuration (Linux, Windows dual record)

Creative Commons License Copyright: Attribution, allow others to create paper-based, and must distribute paper (based on the original license agreement with the same license Creative Commons )

1. Configure Git environment

Since you want to use Git for version control, of course, the first step will certainly be loaded environment, Oh roar

Download and install 1.1

1.1.1 Windows install Git

  • Download the installation package - official website to download - to find their own system corresponding version
  • Installation nothing to say,Opening the installation packageIt isAll the way to nextIs OK
  • Successful validation, just to findFolder blankRight,selectGit Bash Here
    Enter the command, see the version information, that is, the installation was successful
$ git --version
git version 2.20.1.windows.1

1.1.2 Linux install Git

  • A command to download + install all done
# Deepin、Debian
# nangy @ nangy-vm in ~ [8:30:09] 
$ sudo apt install git 

or

# CentOS
# nangy @ nangy-vm in ~ [8:30:09] 
$ sudo yum install git -y
  • To test
# nangy @ nangy-vm in ~ [8:31:18] 
$ git --version 
git version 2.11.0

1.2 Configuring user

  • This step is Linux, Windows configuration, like, so, I'll just stick Liunx interface, after all, I am lazy
  • Git is to submit an updateemailIs identified, it is necessary to configure the Email
    name is optional, also recommended configuration,Easy to identify collaborative developer
  • Priority: Global (global) <Local configuration (local) . 1

1.2.1 Global configuration (global)

  • Configuration
# nangy @ nangy-vm in ~ [8:31:25] 
$ git config --global user.name xxxxx

# nangy @ nangy-vm in ~ [8:36:39] 
$ git config --global user.email [email protected]
  • verification
# nangy @ nangy-vm in ~ [8:31:25] 
$ git config --global user.name
xxxxx

# nangy @ nangy-vm in ~ [8:36:39] 
$ git config --global user.email
[email protected]

1.2.2 Local Configuration (local)

  • This step premise: already have a local Git project,At the root directory of your Git project
  • Configuration
# nangy @ nangy-vm in ~/R-Projects/R-Test on git:master o [18:05:47]
$ git config --local user.name xxxxx

# nangy @ nangy-vm in ~/R-Projects/R-Test on git:master o [18:05:50]
$ git config --local user.email [email protected]
  • verification
# nangy @ nangy-vm in ~/R-Projects/R-Test on git:master o [18:05:52]
$ git config --local user.name
xxxxx

# nangy @ nangy-vm in ~/R-Projects/R-Test on git:master o [18:05:55]
$ git config --local user.email
[email protected]

So far, Git environment configuration


  1. Git extensions:
    local files when submitting Push, priority will read the local user configuration (ie, the current project file .git root folder config files);
    if no local user configuration, then go read the global user configuration;
    both are not, then Push submission failed;
    toConvenienceDifferent Project management, It recommended that each Project is configured local user;
    configure a global user, in order topreventForget to configure a Project, resulting inCan not submitOf course, this time to submit user global user. ↩︎

Guess you like

Origin blog.csdn.net/nangy2514/article/details/92761456