Git的安装和配置用户名和密码

在Windows中进行安装。访问https://git-scm.com/,点击Downloads for Windows,我下载的是Git-2.16.2-64-bit.exe。

都按照默认选项即可,其中有一个选项为

  • Checkout Windows-style,commit Unix-style line endings

这是因为GitHub中公开的代码大部分都是以Mac或Linux中的LF(Line Feed)。然而,由于Windows中是以CRLF(Carriage Return+Line Feed)换行的,所以在非对应的编辑器中将不能正常显示。Git可以通过设置自动转换这些字符。使用Windows环境的各位,选择“Checkout Windows-style, commit Unix-style line endings ”。换行符在签出时会自动转换为CRLF,在提交时则会自动转换为LF。

配置

首先来设置使用git时的姓名和邮箱,随便进入到一个文件夹,然后鼠标右键,Git Bash Here,输入git config –global user.name “eaglezsx”和git config –global user.email “[email protected]”。

YZ@YZ MINGW64 /d
$ git config --global user.name "eaglezsx"

YZ@YZ MINGW64 /d
$ git config --global user.email "[email protected]"

之后就会在C:\Users\YZ下创建一个.gitconfig文件,内容为

[user]
    name = eaglezsx
    email = 15732621728@163.com

git config命令的–global参数,用了这个参数,表示你这台机器上所有的Git仓库都会使用这个配置,当然也可以对某个仓库指定不同的用户名和Email地址。

猜你喜欢

转载自blog.csdn.net/zsx157326/article/details/80059068