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 use git

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

Share

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

This article introduces you how to use git, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Using git for the first time

To install git for the first time, you need to configure a user name and mailbox, otherwise git will prompt: please tell me who you are.

You need to run the command to configure your user name and mailbox:

$git config-- global user.name "youname" $git config-- global user.email "youemail" uses SSH to access worker bees

Generate a new ssh key using Git Bash

$cd ~ / .ssh # switch to C:\ Users\ user name\ .ssh$ ssh-keygen-t rsa-C "xxx@qq.com" # newly created SSH key file. It is recommended to enter your real email address.

As shown below, you can enter any file name to generate the private key at the prompt or leave it empty.

$ssh-keygen-t rsa-C "123456@qq.com" Generating public/private rsa key pair.Enter file in which to save the key (/ c/Users/zcs/.ssh/id_rsa): # enter default id_rsaEnter passphrase (empty for no passphrase): # enter password (can be empty) Enter same passphrase again: # confirm password (can be empty) Your identification has been saved in / c/Users/xxxx/.ssh / id_rsa.Your public key has been saved in / c/Users/xxxx/.ssh/id_rsa.pub.The key fingerprint is:SHA256:w+iaGekSNbTEvUI0uUjFhNZCO3EVD1ly/4W7rZCiQZc 123456@qq.comThe key's randomart image is:+--- [RSA 3072]-+ | .oo * + = + o | = + O.o =. . | | oo* o.. . . . | |. * .o. . O | |. Oo E o | |. +. . . O | | .o. O. . |. = o. . . | |. =. . | | +-[SHA256]-+ |

Next you will see the id_rsa and id_rsa.pub files in the .ssh folder, where the contents of the id_rsa.pub file are the public keys.

View SSH KEY and add KEY to worker bees

$cat id_rsa.pubssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1IPAxNRP1LbM96G4KtE51gychRfnhcaE0D2+GyHIkPTVOcdRJiEFYSWn365t2m67x81JLWpQzyRbMOKO3Xd1dLZ1st+Gf3HjP/57gwsfCu6F9a3x3UvEIL7iYzEGTT6fGd3A1KtFvwqv1fiB7GXkDoYWP6q5mkWL908PPmn2glYi+H7Ncm/sORILUk5WEjAAy39oYh5PXX65O3tB8bYEzUHOHUpvRjEWVNSXGn4ptCjnsgKYfJl12PRkSrMab9reTRv/CYFopVrY/d5REEMpcBUmz2A3yevSJTc30LUO4ydhfRHGzxzU6Xn4quzAr2+D0j+o/yKg4dQL4RXQcpNftr95ggBwtn2PaunoZIxy3yxmLXZa0NGhJl2AuoM3l0ZYKubGU7wCKxCPSy8Fgs0EbgjCfj7V4BwGDPfW6EnQQnpUpN0A1WIrHk2BUxF+aPVMlPK+fHED2BtgGWWYzNYH9HCXYrY10yICSvpK8bCVOF9ZQ3gLIrkNKksWU6dNNnEE= 123456@qq.com

After copying all, open the worker bee git- personal settings-ssh key, click add ssh key in the upper right corner, and then paste the previously copied public key into the input box and fill in a name.

Clone projects using ssh

Copy ssh path

Use the command clone project

$git clone git@git.code.tencent.com:CS-work/work.gitCloning into 'work'...Enter passphrase for key' C:\ Users\ zcs\ .ssh\ zcs':remote: Counting objects: 3, doneremote: Finding sources: 100% (3 Total 3) remote: Total 3 (delta 0), reused 3 (delta 0) Receiving objects: 100% (3 Total 3), done.

On how to use git to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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