Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation and use tutorials for Git

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article focuses on the installation and use of Git tutorials, interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn the "installation and use of Git tutorial" bar!

In the actual project development, we often use some version controllers to host their own code, today to sum up the relevant usage of Git, not much nonsense, just start writing.

Purpose: to manage github managed project code through Git

Download and install Git

1. Download Git from the official address: https://git-scm.com/download/win

2. After downloading, double-click the installation

3. Select the installation directory

4. Select components

5. Start menu directory name setting

6. Choose to use the command line environment

7. By default in the following three steps, click next directly.

8. Installation completed

9. Verify whether the installation is successful

Go back to the computer desktop, right-click if you see two git words, then the installation is successful

II. Basic work flow of Git

1. Git work area

2. Add files to the warehouse process

III. Git initialization and warehouse creation and operation

1. You need to set some basic information after Git installation.

A. Set the user name: git config-- global user.name 'the user name you registered on github'

B. Set user mailbox: git config-- global user.email 'mailbox at registration'

Note: this configuration will show who submitted the file on the github home page

C. After configuring ok, let's use the following command to see if the configuration is successful

Git config-list

Note: git config-- global parameter. This parameter means that all git repositories on your machine will use this configuration. Of course, you can also specify a different user name and mailbox for a warehouse.

2. Initialize a new git repository

A. Create a folder

Method 1: you can right-click-"Click to create a new folder test1

Method 2: use git to create a new: $mkdir test1

B. Initialize git in the file (create git repository)

Method 1: enter $cd test1 directly

Method 1: click the test1 file to enter-"right-click to select Git Bash Here- > enter $git int"

3. Add files to the warehouse

Method 1: create a new index.html file by opening the editor

Method 2: use the git command. $touch 'filename', then add the file to the staging area through $git add 'filename', and finally submit the operation

4. Modify warehouse files

Method 1: open index.html with an editor for modification

Method 2: use the git command. $vi 'file name', then write the content in the middle, and finally submit the operation

5. Delete warehouse files

Method 1: delete the file to be deleted directly in the editor

Method 2: use git to delete: $git rm 'filename', and then submit the operation

4. Git manages remote warehouse

1. The purpose of using remote warehouse: backup and centralized management of code sharing.

Git remote repositories are actually git repository files that are kept on the server.

5. Git clone operation

Purpose: to copy the remote repository (the corresponding project on github) to the local

1. Code: address of git clone warehouse

The origin of the warehouse address is as follows:

2. Clone project

3. Synchronize the local warehouse to the git remote warehouse: git push

Errors occurred during this period are as follows:

A. A submission error occurred

Solution: this is an error that occurs when submitting via Git GUI, because the files in the .git folder are set to "read-only". Just remove the read-only properties of all files, folders and their subfiles under the .git folder.

B. If you cannot synchronize or do not have permissions, the solution is as follows:

The username and password must be the same as those on github.

At this point, I believe you have a deeper understanding of the "installation and use of Git tutorial". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report