Home Development Tools git Installation and use of git under Linux

Installation and use of git under Linux

Mar 02, 2021 am 09:29 AM
git linux

Installation and use of git under Linux

Git installation and use under Linux

Installation steps

  • First, you need to confirm whether there is git in Linux. You can use the git command in the computer to check. If not, use the command sudo apt-get install git to install it.

Recommended (free): Git tutorial

  • Configure git after the installation is complete , you need to ensure that the connection is your open source China account, you need the commands git config --global user.name "XXX" and git config --global user.eamil "email address"

  • After the configuration is completed, you need to create a public key for verification (the same as under windows). Each user needs an independent public key. to make sure. Use the command ssh-key -C 'your email address' -t rsa, and the corresponding key file will be created in the user directory ~/.ssh/

  • Then use the command cd ~/.ssh to enter the folder and use gedit id_rsa.pub to open id_rsa. pub file. The content in the file is the ssh public key, copy it all. Open the open source China website, choose to add the ssh public key, enter the content of the title as you like, and then paste the copied content into it and you are done.

  • You can use the command ssh -T git@git.oschina.net to test whether it is successful.

Need to pay attention during installation

  • Be careful to use the command when configuring ssh-keygen -C 'you email address@gmail.com' -t rsa (note that there is no space between ssh and -keygen)

  • After entering this command There will be an input option of Enter file in which to save the key (/home/haohao/.ssh/id_rsa). Don’t worry about it. This is to choose whether to create the file at the default address or in a new input place. Create (new file name), press Enter, and you can create a new ssh file at the default address.

  • ##Be sure to use

    when opening the id_rsa.pub file gedit id_rsa.pubOtherwise an error may occur.

  • When entering the file

    ~/.ssh folder, just use the command to enter. If you use the mouse to search for it from my computer, you may not be able to find it. Because this folder .ssh is a hidden folder by default. So if you can't find it, you don't have to worry that it's a computer problem, it's just hidden.

The operation after using Git

  • is the same as the operation under Windows. First create a folder yourself , copy the typed code into it, first use the

    git init command to initialize a git warehouse, and then enter git add . (note: add and . There are spaces between ) to add the file, enter git commit -m " comment" to submit to the warehouse.

  • Enter

    git remote add origin https://git.oschina.net/your username/project name.git, enter your account and password.

  • git push origin master to complete the push.

  • Another way to push code was discovered when working together as a team to complete the same project. I don’t know if the process is legal or not, but the result is the same and it works repeatedly.

  • Firstgit clone project address: The project will be downloaded and stored in the folder you created.

  • Then copy the folder of the code that needs to be submitted to the downloaded folder. Use the commands git status, git add XXX.File format name (if it is a folder, you do not need a file format name, just have a file name), git status , git commit -m"comment", git push origin masterEnter the account number and information to complete the push. It will be faster, and the command is simpler than the first one, making it easier to remember and improve efficiency.

Experience

I actually came into contact with the use of git last semester. This is a tool that can quickly improve the work of programmers. program. I also came into contact with Git in the Linux environment this semester, but I have never practiced it due to my laziness. I always felt that if I know git under windows, I will definitely know git under the Linux environment. But I still haven’t mastered it, and there are still unexpected problems. For example, although I have been exposed to git under Linux before, I still have problems when configuring it myself, and I still need to ask my classmates for advice.

And when you simply enter a command, you will make a mistake, such as returning to the upper folder cd ..I did not enter a space when typing, and then an error was reported that there was no such command, and there was no such command. Don't know where I went wrong. Including cd ~ to return to the previous directory, cd - to return to a certain directory, all require spaces.

Although I have discovered a new way to use git that can speed up efficiency, if I don’t have a solid grasp of basic knowledge, everything is still 0. Learning computer operating system knowledge still requires hard work and study. This aspect of knowledge must be practiced on the computer. If you don’t operate it, you will never know whether you have mastered it.

The above is the detailed content of Installation and use of git under Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1653
14
PHP Tutorial
1251
29
C# Tutorial
1224
24
Linux Architecture: Unveiling the 5 Basic Components Linux Architecture: Unveiling the 5 Basic Components Apr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

How to solve the efficient search problem in PHP projects? Typesense helps you achieve it! How to solve the efficient search problem in PHP projects? Typesense helps you achieve it! Apr 17, 2025 pm 08:15 PM

When developing an e-commerce website, I encountered a difficult problem: How to achieve efficient search functions in large amounts of product data? Traditional database searches are inefficient and have poor user experience. After some research, I discovered the search engine Typesense and solved this problem through its official PHP client typesense/typesense-php, which greatly improved the search performance.

laravel installation code laravel installation code Apr 18, 2025 pm 12:30 PM

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

Docker on Linux: Containerization for Linux Systems Docker on Linux: Containerization for Linux Systems Apr 22, 2025 am 12:03 AM

Docker is important on Linux because Linux is its native platform that provides rich tools and community support. 1. Install Docker: Use sudoapt-getupdate and sudoapt-getinstalldocker-cedocker-ce-clicotainerd.io. 2. Create and manage containers: Use dockerrun commands, such as dockerrun-d--namemynginx-p80:80nginx. 3. Write Dockerfile: Optimize the image size and use multi-stage construction. 4. Optimization and debugging: Use dockerlogs and dockerex

How to set the default run configuration list of SpringBoot projects in Idea for team members to share? How to set the default run configuration list of SpringBoot projects in Idea for team members to share? Apr 19, 2025 pm 11:24 PM

How to set the SpringBoot project default run configuration list in Idea using IntelliJ...

When building a microservice architecture using Spring Cloud Alibaba, do you have to manage each module in a parent-child engineering structure? When building a microservice architecture using Spring Cloud Alibaba, do you have to manage each module in a parent-child engineering structure? Apr 19, 2025 pm 08:09 PM

About SpringCloudAlibaba microservices modular development using SpringCloud...

The top ten free platform recommendations for real-time data on currency circle markets are released The top ten free platform recommendations for real-time data on currency circle markets are released Apr 22, 2025 am 08:12 AM

Cryptocurrency data platforms suitable for beginners include CoinMarketCap and non-small trumpet. 1. CoinMarketCap provides global real-time price, market value, and trading volume rankings for novice and basic analysis needs. 2. The non-small quotation provides a Chinese-friendly interface, suitable for Chinese users to quickly screen low-risk potential projects.

What is the analysis chart of Bitcoin finished product structure? How to draw? What is the analysis chart of Bitcoin finished product structure? How to draw? Apr 21, 2025 pm 07:42 PM

The steps to draw a Bitcoin structure analysis chart include: 1. Determine the purpose and audience of the drawing, 2. Select the right tool, 3. Design the framework and fill in the core components, 4. Refer to the existing template. Complete steps ensure that the chart is accurate and easy to understand.

See all articles