Git and Tortoisegit download and install and use detailed configuration process

According to the functional steps you need, click on the directory to jump.

Table of contents

1. Download Git

2. Installation process

3. Settings after git installation

Four, TortoiseGit installation configuration process

 5. Configure tortoise after installation

6. How to use TortoiseGit to download code from Github

Seven, create a local repository

Eight, Commit, Push, Pull/submit, push, pull files


1. Download Git

Download address: https://git-scm.com/downloads

Download the Git software according to your own system version. My operating system: Windows 10 64-bit, the installed version is Git-2.32.0.2-64-bit.exe (the latest version as of 2021-07-22)

 


2. Installation process

1. After the download is complete, double-click the downloaded software to start the installation, and the following dialog box appears

 2. Click Next. The default options are different from those in the picture. It is recommended to modify them according to the picture. Git Bash Here and Git GUI Here can easily open git in any directory. It is recommended to select them. After selecting these two items, click Additional icons->On the Desktop according to their own mood.

After this step is set according to your own needs, you can directly use the default options in the following steps for those who don’t like to toss, of course, you can also study in detail and choose the one that suits you best.

 3. Click next, select the default editor, I chose Notepad++.

 4. Continue to next to configure the PATH environment.

 Use Git from Git Bash only : This is the safest option because your PATH will not be modified at all and you can only use Git command line tools from Git Bash.
Use Git from the Windows Command Prompt : This option is considered safe and it only adds some minimal Git packages to PATH to avoid confusing the environment with optional Unix tools. You will be able to use Git from Git Bash and Windows Command Prompt. It is recommended to select this option.
Use Git and optional Unix tools from the Windows Command Prompt : Both Git and optional Unix tools will be added to your computer's PATH. WARNING: This will override Windows tools such as "find" and "sort", use this option only after understanding its implications.

5. Continue to next, the following options are default

  

6. Click Inall to start the installation, and click Finish after the installation is complete.

 

 7. Test

Click "Git GUI" and "Git Bash" in the start menu, and a window similar to a command line will pop up, indicating that Git is installed successfully!
Right-click in any directory, you can see that there are two options in the right-click menu: Git GUI Here and Git Bash Here.

 [Enter git --version in git bash to check the git version to see if the installation is successful.

git --version

 If Chinese is not displayed normally, please right-click and select "option" to change the language.


3. Settings after git installation

(1) If you go to GitHub to download the code and use it alone , you need to apply for an account , see this step,

If it is the case below, please skip the third step .

(2) If the project team only "push" and pull "" codes, there is no need to register , just let the project administrator open the permissions to the account.


1. After the installation is complete, you need to set up your own git account and email address, otherwise you cannot use it correctly, but so far you have not applied for a git account. Let’s talk about the specific account application and git setting process. Click the account application URL  , and the following interface appears.

insert image description here

 2. Enter the account name you want, your email address and password. The account name can only contain letters and numbers or a single hyphen "-" and the hyphen cannot be used as the beginning or end; the password must contain at least one letter, A number with at least 7 characters in length. After the input is complete, click "Sign up for Github" to enter the following interface. At the same time, you will receive an email from GitHub in the mailbox used for registration.

insert image description here

3. After passing the verification, click "Create an account"

insert image description here

 [If you don't need to keep it secret, you can choose the default free option, and if you need to keep it secret, you need to pay.
Click Continue, and there will be irrelevant answers, just choose, then Submit, and it’s done.

insert image description here

[Because Git is a distributed version control system, each machine must declare itself: your name and email address. After the account application is complete, open the command line or Git Bash, enter]

Among them, Your Name and [email protected] are replaced with the account name and email address when registering above.

git config --global user.name “Your Name”

Then press Enter and enter

git config --global user.email [email protected]

[Enter under the command line or under Git Bash.


Enter the command line as shown in the figure:

insert image description here

 The input under Git Bash is as shown in the figure:

insert image description here

 At this point, the installation and setup of Git is basically over, and it can be used normally on this machine


Four, TortoiseGit installation configuration process

TortoiseGit-Git client and the latest version of 32/64 bits and the corresponding language pack

Download link: https://tortoisegit.org/download/

 [The above is the 64-bit version of the corresponding system, and the following is the Simplified Chinese language pack, click to download directly]

 The method of installation, install according to the above order, just go to the next step.

[click next]

[click next]

 

 [click next]

  [click next]

  【Click next】Choose the installation location

 [Point install]

 【Waiting for installation】

  [point finish]

 [Slow down hand speed]

[The language selection in this step is to pause for a while, do not move this page, double-click to install the downloaded Chinese language pack ]

[Double-click to install the language pack]

 

 【Click Next】

 【Click Finish】

 [Go back to the position where you selected the language before, and click [Refresh] ]

[Choose Chinese, then the next step]

【Click the next page】

 [Choose the location of the previous git installation]

 

[Fill in the git registration information, then the next page]

 

【Click Finish】

 

 5. Configure tortoise after installation

1). First, please select a directory to store Git projects, which is easy to manage. For example: D:\test , and then open it in the resource manager

2). Click the right mouse button in the blank space, and you can see that there are several more options in the right-click menu. Select --> TortoiseGit --> Settings, and then you can see the configuration interface, as shown in the figure below:

3) Select General, and select Chinese in Language. Uncheck the check box for automatic upgrade, you may also need to specify the path of the Git.exe file, such as

        "D:\DevlopPrograms\Git\bin". When finished, click Apply, OK to close the dialog

4) Click the right mouse button again, you can see that the pop-up menu has changed to Chinese.. The original Settings become Settings, and Clone becomes Clone.

5) Configure the right-click menu.. In the setting dialog box, click "Context Menu" on the left to set the commonly used right-click menu. The most common options for homeowners are:

 As above: the configuration is complete.

6. How to use TortoiseGit to download code from Github

Clone the blog source file on git to the local, create a folder locally to store resources, and then right-click in this file, you can see that three options of TortoiseGit have been added to the drop-down menu, and select Git Clone.

Enter the Url to automatically create a local directory, or you can manually select it

Note: Recursion needs to be ticked

After confirmation, the local warehouse will be cloned

Seven, create a local repository

Create a new project directory StudyGit, right click in the code directory and select Create repository

[A prompt pops up, do not check the pure version library, just confirm directly]

[A .git directory is generated under the directory. This directory records content related to git operations, so don't move it. Create a new Code directory.

[So far, the purchase version library has been established. Continue to operate later.

Eight, Commit, Push, Pull/submit, push, pull files

1) After modifying a piece of code, you need to submit the code to the repository

Right click in the above directory:

[When you operate for the first time, you will be prompted to enter your identity (email)]

[click, yes]

 

 [Click to submit.

[After the submission is completed, the following prompt will pop up]

[You can choose to push (if it has been compiled), or you can close it without Push first, and click Push]

[If this is the first time, a dialog box for identity authentication will appear:]

 [Click to manage:]

 [Copy the URL in your github to the above URL, click Add and save.

【Click OK again】

[Just fill in the user name and password during the submission process]

[The result is as follows: success.

 [Go to the remote warehouse to check whether the submission is successful. If the content of the remote warehouse is consistent with the content of the local warehouse, it means that the Push is successful.

Next:

[When other people in the working group write a piece of code and you need to get it, you need to use the Pull operation.

【Finish】

Although the arrangement is very detailed, the above is for reference only. If there are inconsistencies and errors in the process, you need to locate them in time according to the problem, and check the relevant configuration environment and other issues in detail.


The reference articles are as follows:

1、https://my.oschina.net/u/4288355/blog/4667029?hmsr=kaifa_aladdin

2、https://www.jianshu.com/p/414ccd423efc

3、https://blog.csdn.net/hjwdz2015/article/details/90487554

Guess you like

Origin blog.csdn.net/qq_39715000/article/details/119009507