Windows installation and configuration Git tutorial (2022.11.18 Git2.38.1)

(1) First go to the Git official website and download the installation file:

insert image description here

(2) Open the installer Only show new options, uncheck the , and click Next:
insert image description here

(3) You can choose the default settings here, or you can check Add a Git Bash Profile to Windows Terminal:
insert image description here

(4) Select the editor here, generally use Vim directly:
insert image description here

(5) Here is to set the name of the Git initialization branch, the default is master, you can also choose to customize:
insert image description here

(6) Choose the way to use Git here, usually choose the first one:
insert image description here

(7) Select ssh, the first one is fine:
insert image description here

(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:
insert image description here

(9) Configure the end line conversion method, that is, the way Git handles the end line of text. Windows can choose the first one:
insert image description here

(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:
insert image description here

(11) Choose the default behavior git pullof 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:
insert image description here

(12) Select the Git credential assistant and choose the first one:
insert image description here

(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:
insert image description here

(14) Experimental features, generally do not need to be selected, just install directly:
insert image description here

(15) After installation, open Git Bash, enter git -v, and you can see the following results:

insert image description here

(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.pubCopy the content in to GitHub's SSH Keys:

insert image description here

Test whether you are connected to GitHub:

ssh -T [email protected]

The result is as follows, indicating that the configuration is successful:

insert image description here

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/configthe 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

Guess you like

Origin blog.csdn.net/m0_51755720/article/details/127914510
Recommended