(1) First go to the Git official website and download the installation file:
(2) Open the installer Only show new options
, uncheck the , and click Next
:
(3) You can choose the default settings here, or you can check Add a Git Bash Profile to Windows Terminal
:
(4) Select the editor here, generally use Vim directly:
(5) Here is to set the name of the Git initialization branch, the default is master
, you can also choose to customize:
(6) Choose the way to use Git here, usually choose the first one:
(7) Select ssh, the first one is fine:
(8) Select the https transmission backend, the first option uses the OpenSSL library, and the second option uses the native Windows secure channel library, just choose the first one:
(9) Configure the end line conversion method, that is, the way Git handles the end line of text. Windows can choose the first one:
(10) Configure the terminal to use Git Bash. The first option is to use MinTTY as a terminal emulator, and the second option is to use the default console of Windows. Generally, choose the first one:
(11) Choose the default behavior git pull
of git pull
, the first option is the standard behavior of : fast-forward the current branch to a captured branch as much as possible, otherwise create a merge commit; the second option is to change the current branch to the fetched branch. This is equivalent to a fast-forward if there are no local commits to rebase; the third option is to just fast-forward, to the fetched branch, or fail if not possible. Choose the first option here:
(12) Select the Git credential assistant and choose the first one:
(13) Configure additional features. The first option is to enable file system caching, and the second option is to support symbolic links. Just tick the first one:
(14) Experimental features, generally do not need to be selected, just install directly:
(15) After installation, open Git Bash, enter git -v
, and you can see the following results:
(16) Enter the following command to configure Git:
git config --global user.name "Github用户名"
git config --global user.email "Github邮箱"
For example:
git config --global user.name "AsanoSaki"
git config --global user.email "[email protected]"
Generate public key:
ssh-keygen -t rsa
~/.ssh/id_rsa.pub
Copy the content in to GitHub's SSH Keys:
Test whether you are connected to GitHub:
ssh -T [email protected]
The result is as follows, indicating that the configuration is successful:
If there is an error message: ssh: connect to host github.com port 22: Connection timed out
, indicating that port 22 may be blocked by the firewall, you can try to connect to port 443 of GitHub. We modify ~/.ssh/config
the file to the following content, so that port 443 will be used when SSH connects to GitHub:
Host github.com
HostName ssh.github.com
User 你的GitHub用户名
Port 443