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

How to install and configure Git on Ubuntu system

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains "how to install and configure Git in Ubuntu system". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to install and configure Git on the Ubuntu system.

1. Git installation:

1. Binary installation:

$sudo apt-get install git-core

After the installation is complete, type git in the terminal and you can see the relevant commands. If you just need to use git to manage local code, you can use it now. There are other actions that need to be done if you need to integrate with the project on github.

2. Application for github account

If you just need to copy the code you are interested in on github locally, modify it yourself, and do not intend to share it, it doesn't matter if you don't apply for an account, you just need the git clone code locally. $git clone git:// IP work (work directory name).

After all, the use of github is for the purpose of open source, first go to github.com to sign up for an account.

3. Set up a folder locally and initialize some global variables

$git config-- global user.name = "user name or user ID"

$git config-- global user.email = mailbox

These two options are automatically added to the code for later use.

4. Create a public key for authentication

This is more complicated and bothering most people, because git accesses the repository through ssh, so you need to create validation files locally. Use the command: $ssh-keygen-C 'you email address@gmail.com'-t rsa will establish the corresponding key file in the user directory ~ / .ssh/. You can use the $ssh-v git@github.com command to test whether the link is open.

5. Upload the public key

Select Account Settings in the upper right corner of the github.com interface, then select SSH Public Keys, and select add New.

Title can be named freely, and the content of Key is copied from the content in ~ / .ssh/id_rsa.pub. When you are finished, you can test it with ssh-v git@github.com. The following message indicates that the verification was successful.

II. Configuration and use of Git

To manage your own project with github, you can follow these steps

1. Set up a warehouse

In the folder where you need to build the project, use git init to build the warehouse. When you are finished, you can see that a .git hidden directory has been added to the file home.

2. Add files

Use git add. To add the initial file. Here it is. It means that all the files under the folder are added, or we can specify the files to be added.

3. Submit documents

Using git commit-m 'comment' submission, you can submit the edited content.

4. Delete or add github remote sources

Git remote add origin https://github.com/Git-Elite/CodeBase.git / / the blue part is the address of the warehouse hosted by github

5. Submit to github warehouse

Git push-u origin master

At this point, I believe you have a deeper understanding of "how to install and configure Git on the Ubuntu system". 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