前言
- 归属专栏: 《前端环境搭建与准备-指引》
- 上上一篇: git安装
- 上一篇:pnpm配置(
抱歉我还没写,后续补上
)- 本文内容:git安装
- 下一篇:SSH保存身份验证
1.git下载
git官网:git-scm.com/downloads/
1.1 下载windows版本
1.2 下载64位安装程序
2. 安装
双击运行exe,选择安装到自定义文件夹路径下(安装到一个非中文没有空格的目录下 )
Step 1: infomation
Please read the following important information before continuing
继续之前,请阅读以下重要信息
Step 2: Select Destination Location
Where should Git be installed?
Git安装到哪里?
Step 3: Select Components
Which components should be installed?
下面哪些是需要安装的组件?
勾选上首尾两项,(根据自己需要,我是自己需要到的进行勾选,windows )
-
Additional icons
附加图标On the Desktop
桌面快捷方式
-
Windows Explorer integration Windows
资源管理器集成鼠标右键菜单-
Git Bash Here
是在当前目录运行Git命令行,必选 -
Git GUI Here
在当前目录运行Git原生界面,UI体验
-
-
Git LFS (Large File Support)
git的大文件传输支持,一个git仓库总容量1G,需要增加可以付费 -
Associate .git* configuration files with the default text editor
将所有.git开头的文件使用默认文本编辑器打开 -
Associate .sh files to be run with Bash
是将所有扩展名为.sh的文件使用Git命令行执行 -
Use a TrueType font in all console windows
是在所有命令行(包括cmd命令行窗口)中都使用TrueType字体 -
Check daily for Git for Windows updates
每天检查git版本的更新 -
(NEW!) Add a Git Bash Profile to windows Terminal
添加git bash 的预览文件到Windows Terminal
Step 4: Select Strat Menu Folder
创建开始菜单目录
Where should Setup place the program's shortcuts?
安装程序将创建程序快捷方式放置到哪个位置?
安装程序将创建程序的快捷方式,在下面的“开始”菜单文件夹。
Step 5: Choosing the default editor used by Git
Which editor would you like Git to use?
你想要哪个编辑器作为git使用时的默认编辑器?
选项解释:
选择git默认编辑器,推荐使用vim。
-
Use the Nano editor by default
默认使用 Nano 编辑器 -
Use Vim (The ubiquitous text editor) as Git’s default editor
使用 Vim(无处不在的文本编辑器) 作为 Git 的默认编辑器 -
Use Notepad++ as Git’s default editor
使用 Notepad++ 作为 Git 的默认编辑器 -
Use Visual Studio Code as Git’s default editor
使用 Visual Studio Code 作为 Git 的默认编辑器 -
Use Visual Studio Code Insiders as Git’s default editor
使用 Visual Studio Code Insiders 作为 Git 的默认编辑器 -
Use Sublime Text as Git’s default editor
使用Sublime Text作为Git的默认编辑器 -
Use Atom as Git’s default editor
使用Atom 作为Git的默认编辑器 -
Use VSCodium as Git’s default editor
使用VSCodium 作为Git的默认编辑器 -
Use Notepad as Git’s default editor
使用 Notepad作为 Git 的默认编辑器 -
Select other editor as Git’s default editor
选择其他编辑器作为Git的默认编辑器
Step 6: Adjusting the name of the initial branch in new repositories
Which would you like Git to name the initial branch after "git init"?
在使用命令“git init”后你想要git命名主干名称默认为什么(新存储库中初始分支的名称)?
Step 7: Adjusting your PATH environment
How would you like to use Git from the commond line?
你想从命令行中如何使用git?
配置PATH环境
进入环境变量配置,根据需求选择,②为windows环境,③为linux环境。
-
Use Git from Git Bash only
This is the safest choice as your PATH will not be modified at all.You will only be able to use the Git command line tools form Git Bash
.
这是最安全的选择,因为您的PATH根本不会被修改。您只能使用 Git Bash 的 Git 命令行工具。 只能在Git Bash中使用。不会修改系统环境变量,但是Windows系统cmd命令行中无法使用git命令。
-
Use Git from the Windows Command Prompt
This option is considered safe as it only adds some minimal Git wrappers to your PATH to avoid cluttering your environment with optional Unix tools . You will be able to use Git from both Git Bash and the Windows Command Prompt.
这个选项被认为是安全的,因为它只向PATH添加一些最小的 Git包,以避免使用可选的Unix工具混淆环境。 您将能够从 Git Bash 和 Windows 命令提示符中使用 Git。
会将git相关程序加入系统环境变量中,使得Windows系统cmd命令行中可以使用git命令。它只向路径添加了一些最小的Git包装器,以避免使用可选的Unix工具破坏环境。用户将能够从Git Bash、命令提示符和Windows中使用Git。
Use Git and optional Unix tools from the Windows Command Prompt
Both Git and the optional Unix tools will be added to you PATH
Warning:This will override Windows tools like "find and sort".Only use this option if you understand the implications.
从Windows命令提示符使用Git和可选的Unix工具,会将git相关程序以及一些其他的Unix工具加入系统环境变量,使得Windows系统cmd命令行中可以使用git以及Unix工具。
Git和可选的Unix工具都将添加到您计算机的 PATH 中
警告:这将覆盖Windows工具,如 “ find 和 sort ”。只有在了解其含义后才使用此选项。
Step 8: Choosing the SSH executable
Which Secure Shell client program would you like Git to Use?
你想Git 使用哪种SSH客户端程序?
选择SSH可执行文件
-
Use bundled OpenSSH
This use ssh.exe that comes with Git.
使用捆绑的 OpenSSH
这使用的 ssh.exe 是 Git 自带的
-
Use external OpenSSH
New! This uses an external ssh.exe,Git will not install its own OpenSSH(and related) binaries but use them as found on the PATH
使用外部OpenSSH
新!这使用外部 ssh.exe 文件。 Git 不会安装自己的 OpenSSH(和相关)二进制文件,而是使用在环境变量 PATH 中找到的它们
Step 9: Choosing HTTPS transport backend
Which SSL/TLS library would you like to use for HTTPS connentions?
你想使用哪种SSL/TLS库来用于HTTPS传输?
选择HTTPS传输后端
-
Use the OpenSSL library
-
Server certificates will be validated using the ca-bundle. crt file.
使用 OpenSSL 库
服务器证书将使用 ca-bundle.crt 文件进行验证
-
Use the native Windows Secure Channel library
Server certificates will be validated using Windows Certificate Stores. This option also allows you to use your company's internal Root CA certificates distributed e.g. via Active Directory Domain Services.
使用本机 Windows 安全通道库
服务器证书将使用 Windows 证书存储进行验证。 此选项还允许您使用公司内部分发的内部根 CA 证书,例如通过 Active Directory 域服务
Step 10:Configuring the line ending conversions
How should Git treat line endings in text files?
Git应该如何处理文本文件中的行尾换行符?
配置行尾换行符转换格式
Windows的换行符合Linux的换行符如何兼容,为了后续我们在拉取代码和提交代码时,行尾换行符保持。
-
Checkout Windows-style, commit Unix-style line endings
Git will convert LF to CRLF when checking out text files.When committing text files, CRLF will be converted to LF. For cross-platform projects, this is the recommended setting on Windows("core. autocrif"is set to "true").
签出 Windows 样式,提交 Unix 样式的行结尾
Git 签出文本文件时,会将 LF 转换为 CRLF。提交文本文件时,CRLF 将转换为 LF。对于跨平台项目,这是 Windows 上的建议设置("core.autocrif" 设置为 "true")
-
Checkout as-is, commit Unix-style line endings
Git will not perform any conversion when checking out text files. When committing text files, CRLF will be converted to LF. For cross-platform projects, this is the recommended setting on Unix("core.autocrif" is set to "input").
按原样签出,提交 Unix 样式的行结尾
Git 在签出文本文件时不会执行任何转换。提交文本文件时,CRLF 将转换为 LF。对于跨平台项目,这是在 Unix 上的建议设置("core.autocrif" 设置为 "input")。
-
Checkout as-is, commit as-is
Git will not perform any conversions when checking out or committing text files.Choosing this option is not recommended for cross-platform projects("core. autocrif"is set to "false").
按原样签出,按原样提交
Git 在签出或提交文本文件时不会执行任何转换。 不建议跨平台项目选择此选项("core.autocrif" 设置为 "false")。
Step 11:Configuring the terminal emulator to use with Git Bash
Which terminal emulator do you want to use with your Git Bash?
你想选择哪个终端模拟器以与 Git Bash 一起使用?
配置终端模拟器以与 Git Bash 一起使用
-
Use MinTTY(the default terminal of MSYS2)
Git Bash will use MinTTY as terminal emulator, which sports a resizable window non-rectangular selections and a Unicode font.Windows console programs(such as interactive Python) must be launched via 'winpty' to work in MinTTY
使用 MinTTY(MSYS2的默认终端)
Git Bash 将使用 MinTTY 作为终端仿真器,该仿真器具有可调整大小的窗口非矩形选择和 Unicode 字体。 Windows 控制台程序(例如交互式 Python)必须通过 "winpty" 启动才能在 MinTTY 中运行。
-
Use Windows' default console window
Git will use the default console window of Windows("cmd.exe"), which works well with Win32 console programs such as interactive Python or node. js, but has a very limited default scroll-back,needs to be configured to use a Unicode font in order to display non-ASCII characters correctly, and prior to Windows 10 its window was not freely resizable and it only allowed rectangular text selections
使用 Windows 的默认控制台窗口
Git 将使用 Windows 的默认控制台窗口("cmd.exe"),该窗口可与 Win32 控制台程序(例如交互式Python 或 node.js)一起使用,但默认回滚非常有限,需要将其配置为使用 Unicode 字体才能正确显示非 ASCII 字符,并且在 Windows 10 之前,其窗口不可随意调整大小,并且仅允许选择矩形文本。
建议选择第一种,MinTTY 3功能比 cmd 多,cmd 只不过 比 MinTTY 更适合处理 Windows 的一些接口问题,这个对 Git 用处不大,除此之外 Windows 的默认控制台窗口(cmd)有很多劣势,比如 cmd 具有非常有限的默认历史记录回滚堆栈和糟糕的字体编码等等。 相比之下,MinTTY 具有可调整大小的窗口和其他有用的可配置选项,可以通过右键单击的工具栏来打开它们 git-bash
Step 12:Choosing the default behavior of "git pull"
What should "git pull" do by default?
"git pull" 默认操作应该要做什么工作?
选择默认的 “git pull” 行为
-
Default(fast-forward or merge)
This is the standard behavior ofgit pull": fast-forward the current branch to the fetched branch when possible, otherwise create a merge commit
默认(快进或合并)
这是 "git pull" 的标准行为:在可能的情况下将 当前分支 快进到 获取的分支,否则创建合并提交。
-
Rebase
Rebase the current branch onto the fetched branch. If there are no local commits to rebase, this is equivalent to a fast-forward
变基
变基将当前分支变基到获取的分支上。如果没有本地提交要变基,则等同于快进。
Only ever fast-forward
Fast-forward to the fetched branch. Fail if that is not possible
只能快进
快进到获取的分支。如果不可能,则失败
“git pull” 是什么意思呢? git pull 就是获取最新的远程仓库分支到本地,并与本地分支合并
上面给了三个 “git pull” 的行为:
第一个是 merge,也就是说git pull = git fetch + git merge
第二个是 rebase,也就是说git pull = git fetch + git rebase
第三个是 直接获取,也就是说git pull = git fetch
git pull 只是拉取远程分支并与本地分支合并,而 git fetch 只是拉取远程分支,怎么合并,选择 merge 还是 rebase ,可以再做选择。
Step 13:Choose acredential helper
Which crediential helper should be configured?
应配置哪个凭证助手?
选择一个凭证助手
-
Git Credential Manager
Use the cross-platform Git Credential Manager. See more information about the future of Git Credential Manager here.
Git 凭证管理
使用跨平台的 Git 凭证管理。 在此处查看有关 Git 凭证管理未来的更多信息
-
None
Do not use a credential helper
无
不使用凭证助手
Step 14: Configuring extra options
Which feature would you like to enbale?
你希望启用哪个功能?
配置额外的选项
-
Enable file system caching
File system data will be read in bulk and cached in memory for certain operations("core.fscache" is set to "true"). This provides a significant performance boost
启用文件系统缓存
将批量读取文件系统数据并将其缓存在内存中以进行某些操作("core.fscache” 设置为 "true")。这可以显着提高性能。
-
Enable symbolic links
Enable symbolic links(requires the SeCreateSymbolicLink permission). Please note that existing repositories are unaffected by this setting.
启用符号链接
启用符号链接(需要SeCreateSymbolicLink权限)。请注意,现有存储库不受此设置的影响。
Step 15: Configuring experimental options
These feature are developed actively,Would you like to try them?
这些功能都是正在开发中的,你想试试吗?
配置实验性选项
-
Enable experimental support for pseudo consoles
(NEW!) This allows running native console programs like Node or Python in a Git Bash window without using winpty, but it still has known bugs
启用对伪控制台的实验性支持
(新功能!) 这允许在不使用 winpty 的情况下在 Git Bash 窗口中运行诸如 Node 或 Python 之类的本机控制台程序, 但是它仍然存在已知的 bug
-
Enable experimental built-in file system monitor
(NEW!) Automatically run a built-in file system watcher, to speed up common operations such as ' git status', ' git add', ' git commit', etc in worktrees containing many files.
启用实验性内置文件系统监视器
(新!)自动运行内置文件系统监视器,以加快包含许多文件的工作树中的 常见操作,例如 'git status'、'git add'、'git commit' 等.
Step 16: Installing
安装中.....
安装完成
安装后会在开始菜单中出现:
检查环境变量,环境变量中新增加了:D:\Git\cmd
如果环境变量中没有,则需要手动添加,其中,D:\Git是GIt的安装路径,step2中的。安装路径\cmd
专栏指引
- 归属专栏: 《前端环境搭建与准备-指引》
- 上上一篇: git安装
- 上一篇:pnpm配置(
抱歉我还没写,后续补上
)- 下一篇:SSH保存身份验证