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

Getting started with Git and GitHub

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Introduction to getting started with Git

Git is an open source distributed version control system developed by Linus Torvalds to help manage Linux kernel development.

Tool preparation tool

Git download address: https://git-scm.com

Git configuration

The main contents of the configuration are: user name and mailbox

Git config-global-add user.name git config-global-add user.email

The configuration example is shown in the figure:

Getting started example creates a project mkdir testcd test initializes the project repository git init

After initialization is complete, you can add and modify files in the project directory test, such as adding a file called Hello.java.

Add files to temporary storage area git add Hello.java submit files in temporary storage area to warehouse git commit-m add view file status git status view submission log git log legend

GitHub entry registration account

Login account

Create a project

Code hosting

There are two situations when creating a warehouse in GitHub:

The first situation:

When creating, select the initialization warehouse, which is suitable for the new project warehouse. There is no project warehouse on the local computer. Copy the code to the local computer through the command.

Git clone https://github.com.broncho/test.git

The second situation:

Create is not selected to initialize the warehouse, suitable for the local computer already exists in the project repository, through the command to upload the code to the server.

HTTPS mode

HTTPS mode for remote warehouse connection, each push code, need to be authenticated.

View remote warehouse source git remote-v add remote warehouse source git remote add origin https://github.com/bronch/test.git push code to remote warehouse git push origin master diagram

SSH mode

SSH mode for remote warehouse connection, each push code, do not need to authenticate again, but need to provide the public key to the remote warehouse.

Generate public key and private key ssh-keygen

During the generation process, you can enter all the way without specifying a password.

The figure shows:

GitHub sets the public key

The figure shows:

Code hosting View remote Warehouse Source git remote-v add remote Warehouse Source git remote add origin git@github.com:broncho/test.git push Code to remote Warehouse git push origin master icon

Common command

Learning material Code Cloud (https://gitee.com)GitHub(https://github.com)Git knowledge Collection (https://gitee.com/help/categories/43)Git rookie textbook) https://www.runoob.com/git/git-tutorial.html)

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

Internet Technology

Wechat

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

12
Report