How to configure Git on Linux Ubuntu

  This article introduces the detailed method of configuring the distributed open source version control system Git in the Ubuntu version of the Linux operating system , and then cloning the code of the project in GitHub based on Git .

  In the previous article, download, install and use the distributed version control system Git, how to copy the GitHub project code (https://blog.csdn.net/zhebushibiaoshifu/article/details/127412101) and the use of GitHub and Git software (https ://blog.csdn.net/zhebushibiaoshifu/article/details/113888067), we introduced how to download and install Git on Windows computers ; and this article introduces how to implement this operation on Ubuntu systems .

First, we now enter the following code in the terminal to check whether Git   is already available on the current computer .

git --version

  Run the above code. Since I have already installed Git here , it is as shown in the figure below.

If you don’t have Git   on your computer yet , just execute the following two lines of code respectively.

sudo apt update
sudo apt install git

  After executing the second sentence of code above, since I have already installed Git here , it is as shown in the figure below.

  At this point, we have completed the configuration of Git ; compared with the method of using the Git software installation package configuration on a Windows computer , this method is relatively simpler.

  Next, we also need to set the user name and email address for Git ; Git will use this information to identify you when submitting code. First, we can enter the following code to view our current username and email settings.

git config --list

  Since we have not configured this information at this time, running the above code is as shown in the figure below.

  Next, we set our username and email address through the following code (remember to replace the Chinese characters in the code below with your information); in principle, we can configure our own username and email address at will, but for the convenience of future use, It is recommended that you choose a username and email address that are consistent with or related to your own GitHub (or similar website).

git config --global user.name 你的用户名
git config --global user.email 你的邮箱

  Execute the above two lines of code respectively, as shown in the figure below.

  Then, use the preceding code to view our information.

git config --list

  After running the above code, as shown in the figure below, you can see that our information can be displayed at this time.

  At this point, we have completed the initial configuration of Git . Next, you can clone the GitHub project code, submit the code and other operations. For example, with the following code, we can clone a project about Docker teaching in GitHub .

git clone https://github.com/docker/getting-started-app.git

  After running the above code, it is shown in the figure below.

  It should be noted here that after we clone the project, the project file will be saved in the current path of the terminal ; because my terminal here is in the default path when executing the above code , so as shown in the figure below, my project is saved in Homethe folder middle.

  At this point, you're done.

Welcome to follow: Crazy Learning GIS

Guess you like

Origin blog.csdn.net/zhebushibiaoshifu/article/details/133326666