Windows下安装Git

Git

Git是一个免费的开源 分布式版本控制系统,旨在处理速度和效率从小到大的项目。

https://gitforwindows.org/
https://github.com/git-for-windows/git/releases/

介绍

1.Git BASH

Git for Windows provides a BASH emulation used to run Git from the command line. *NIX users should feel right at home, as the BASH emulation behaves just like the “git” command in LINUX and UNIX environments.

2.Git GUI

As Windows users commonly expect graphical user interfaces, Git for Windows also provides the Git GUI, a powerful alternative to Git BASH, offering a graphical version of just about every Git command line function, as well as comprehensive visual diff tools.

3.Shell Integration

Simply right-click on a folder in Windows Explorer to access the BASH or GUI.

来源 : https://gitforwindows.org/

安装

1.Adjusting your PATH environment

Use Git from the Windows Command Prompt

2.Configuring the line ending conversions

Checkout Windows-style, commit Unix-style line endings

3.Configuring the terminal emulator to use with Git Bash

Use MinTTY(…)

4.Configuring extra options

Enable Git Credential Manager

配置

添加环境变量,在开始菜单里找到”Git” - > “Git Bash”

1
2
$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"

然后就可以开始git之旅了。

遇到的问题

删除提交记录

1.clone

1
git clone https://github.com/username/username.github.io.git

2.删除.git文件夹和其他数据

3.git init

1
git init

4.创建一个txt

5.git add .

1
git add .

6.提交

1
git commit -m "Initial commit"

7.强制提交更新

1
git push -u --force origin master

相关主题