本文講解Windows下Git的安裝
一 、Git的下載
進(jìn)入官方地址:https://git-scm.com/download/win
二 缰儿、Git在Windows下的詳細(xì)安裝
2.1. 運(yùn)行Git安裝文件
Step 1 Information(信息)
說(shuō)明: |
---|
Please read the following important information before continuing |
繼續(xù)之前,請(qǐng)閱讀以下重要信息 |
Step 2 Select Destination Location
選擇安裝位置
Step 3 Select Components
選擇組件
關(guān)于Git GUI Here瘾婿。目前我都是使用Git Bash來(lái)進(jìn)行操作馒胆。使用Git GUI確實(shí)可以得到更好的UI體驗(yàn)热康,不過(guò)個(gè)人認(rèn)為會(huì)減低效率消返。并且初學(xué)者還是先搞懂Git的常用指令之后载弄,再使用Git GUI才會(huì)有更好的理解。
說(shuō)明: |
---|
(1)Additional icons: 附加圖標(biāo) |
(2)On the Desktop: 在桌面上 |
(3)Windows Explorer integration Windows: 資源管理器集成鼠標(biāo)右鍵菜單 |
Git Bash Here |
Git GUI Here |
(4)Git LFS (Large File Support): 大文件支持 |
(5)Associate .git/* configuration files with the default text editor: 將 .git 配置文件與默認(rèn)文本編輯器相關(guān)聯(lián) |
(6)Associate .sh files to be run with Bash: 將.sh文件關(guān)聯(lián)到Bash運(yùn)行 |
(7)Use a TrueType font in all console windows: 在所有控制臺(tái)窗口中使用TrueType字體 |
(8)Check daily for Git for Windows updates: 每天檢查Git是否有Windows更新 |
Step 4 Select Strat Menu Folder
創(chuàng)建開始菜單目錄(開始菜單目錄名設(shè)置)
Don't create a Start Menu folder
不創(chuàng)建“開始”菜單文件夾撵颊,不勾選宇攻。
Step 5 Choosing the default editor used by Git
選擇Git使用的默認(rèn)編輯器
說(shuō)明: |
---|
Use the Nano editor by default: 默認(rèn)使用 Nano 編輯器 |
Use Vim (The ubiquitous text editor) as Git's default editor: 使用 Vim 作為 Git 的默認(rèn)編輯器 |
Use Notepad++ as Git's default editor: 使用 Notepad++ 作為 Git 的默認(rèn)編輯器 |
Use Visual Studio Code as Git's default editor: 使用 Visual Studio Code 作為 Git 的默認(rèn)編輯器 |
Use Sublime Text as Git's default editor: 使用 Sublime Text 作為 Git 的默認(rèn)編輯器 |
可選操作根據(jù)自己習(xí)慣。
Step 6 Adjusting your PATH environment
配置PATH環(huán)境
說(shuō)明: |
---|
(1)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.
|
翻譯:這是最安全的選擇倡勇,因?yàn)槟腜ATH根本不會(huì)被修改逞刷。您只能使用 Git Bash 的 Git 命令行工具。 |
(2)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.
|
翻譯:這個(gè)選項(xiàng)被認(rèn)為是安全的,因?yàn)樗幌騊ATH添加一些最小的 Git包夸浅,以避免使用可選的Unix工具混淆環(huán)境仑最。 您將能夠從 Git Bash 和 Windows 命令提示符中使用 Git。(也就是在Windows的命令行cmd中也可以運(yùn)行g(shù)it命令题篷,操作上帶來(lái)方便) |
(3)Use Git and optional Unix tools from the Windows Command Prompt |
從Windows命令提示符使用Git和可選的Unix工具 |
Both Git and the optional Unix tools will be added to you PATH |
Git和可選的Unix工具都將添加到您計(jì)算機(jī)的 PATH 中 |
Warning:This will override Windows tools like "find and sort".Only use this option if you understand the implications. |
警告:這將覆蓋Windows工具词身,如 “ find 和 sort ”。只有在了解其含義后才使用此選項(xiàng)番枚。 |
選擇默認(rèn)第二項(xiàng):會(huì)自動(dòng)配置好git命令的環(huán)境變量。
第一項(xiàng)簡(jiǎn)述:直接安裝损敷,不會(huì)配置git命令的環(huán)境變量葫笼,需要手動(dòng)配置環(huán)境變量。
第三項(xiàng):基本沒(méi)用拗馒。
Step 7 Choosing HTTPS transport backend
選擇HTTPS傳輸后端路星,也就是使用哪個(gè)加密庫(kù)來(lái)加密http傳輸?shù)男畔ⅲJ(rèn)是使用openssl诱桂,一般都是使用默認(rèn)設(shè)置洋丐。
說(shuō)明: |
---|
(1)Use the OpenSSL library |
使用 OpenSSL 庫(kù) |
Server certificates will be validated using the ca-bundle.crt file. |
服務(wù)器證書將使用ca-bundle.crt文件進(jìn)行驗(yàn)證。 |
(2)Use the native Windows Secure Channel library |
使用本地 Windows 安全通道庫(kù) |
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. |
服務(wù)器證書將使用Windows證書存儲(chǔ)驗(yàn)證挥等。此選項(xiàng)還允許您使用公司的內(nèi)部根CA證書友绝,例如, 通過(guò)Active Directory Domain Services 肝劲。 |
Step 8 Configuring the line ending conversions
選擇提交的時(shí)候換行格式
說(shuō)明: |
---|
(1)Checkout Windows-style,commit Unix-style line endings |
翻譯:檢查出windows格式轉(zhuǎn)換為unix格式:將windows格式的換行轉(zhuǎn)為unix格式的換行再進(jìn)行提交迁客。 |
(2)Checkout as-is , commit Unix-style line endings** |
翻譯:檢查出原來(lái)格式轉(zhuǎn)為unix格式:不管什么格式的,一律轉(zhuǎn)為unix格式的換行再進(jìn)行提交辞槐。 |
(3)Checkout as-is,commit as-is |
不進(jìn)行格式轉(zhuǎn)換 : 不進(jìn)行轉(zhuǎn)換掷漱,檢查出什么,就提交什么榄檬。 |
也就是提交代碼時(shí)使用哪種風(fēng)格卜范,使用默認(rèn)設(shè)置即可。
Step 9 Configuring the terminal emulator to use with Git Bash
使用哪個(gè)軟件作為git的終端程序鹿榜,默認(rèn)使用minTTY海雪,還屬于比較好用的終端,直接使用默認(rèn)設(shè)置
說(shuō)明: |
---|
(1)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.
|
翻譯:Git Bash將使用MinTTY作為終端模擬器犬缨,該模擬器具有可調(diào)整大小的窗口喳魏,非矩形選區(qū)和Unicode字體。 Windows控制臺(tái)程序(如交互式Python)必須通過(guò)'winpty'啟動(dòng)才能在MinTTY中運(yùn)行怀薛。 |
(2)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 aUnicode font in order to display non-ASCII characters correctly,and prior to Windows 10 its windows was not freely resizable and it only allowed rectangular text selections.
|
翻譯:Git將使用Windows的默認(rèn)控制臺(tái)窗口(“cmd.exe”)刺彩,該窗口可以與Win32控制臺(tái)程序(如交互式Python或node.js)一起使用,但默認(rèn)的回滾非常有限,需要配置為使用unicode 字體以正確顯示非ASCII字符创倔,并且在Windows 10之前嗡害,其窗口不能自由調(diào)整大小,并且只允許矩形文本選擇畦攘。 |
Step 10 Configuring extra options
配置額外的選項(xiàng)霸妹,如是否開啟文件緩存之類的輔助功能,默認(rèn)選擇即可
說(shuō)明: |
---|
(1)Enable file system caching |
啟用文件系統(tǒng)緩存 |
描述: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.
|
翻譯:文件系統(tǒng)數(shù)據(jù)將被批量讀取并緩存在內(nèi)存中用于某些操作(“core.fscache”設(shè)置為“true”)知押。 這提供了顯著的性能提升叹螟。 |
(2)Enable Git Credential Manager |
啟用Git憑證管理器 |
描述:The Git Credential Manager for Windows provides secure Git credential storage for Windows,most notably multi-factor authentication support for Visual Studio Team Services and GitHub. (requires .NET framework v4.5.1 or or later).
|
翻譯:Windows的Git憑證管理器為Windows提供安全的Git憑證存儲(chǔ),最顯著的是對(duì)Visual Studio Team Services和GitHub的多因素身份驗(yàn)證支持台盯。 (需要.NET Framework v4.5.1或更高版本)罢绽。 |
(3)Enable symbolic links |
啟用符號(hào)鏈接 |
描述:Enable symbolic links (requires the SeCreateSymbolicLink permission).Please note that existing repositories are unaffected by this setting.
|
翻譯:?jiǎn)⒂梅?hào)鏈接(需要SeCreateSymbolicLink權(quán)限)。請(qǐng)注意静盅,現(xiàn)有存儲(chǔ)庫(kù)不受此設(shè)置的影響良价。 |
Step 11 Installing
安裝
Step 12 Completing the Git Setup Wizard
完成Git安裝向?qū)?/strong>
三、驗(yàn)證Git是否安裝成功
進(jìn)入cmd和Git客戶端蒿叠,輸入git --version明垢,查看版本信息,出現(xiàn)證明安裝成功
在桌面右鍵市咽,顯示Git GUI Here和Git Bash Here痊银。