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

The method of using git to connect github through ssh in vscode

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Vscode is currently developing rapidly, and its ease of use is far more than that of other text editors such as nodepad. This time, it is found that the function of git inherited by vscode is very powerful and convenient. Here is a brief description of the steps of connecting git to github for memo.

1. The console version of git has been installed first.

Initialization

$git config-- global user.name author # sets the user name to author$ git config-- global user.email author@corpmail.com # sets the user mailbox to author@corpmail.com

2. Create a new git library in vscode

After it is built, the effect appears as shown in the figure. This is that a git library has been added to the local current folder. To add something to this library, you can use the menu options provided by vscode. I will not repeat it here.

3. Open the command console and say powershell, locate the current directory to ${your git installation directory}\ usr\ bin, and enter the following command ssh-keygen-t rsa-C "your_email@example.com". After that, when you need to enter the password, you can enter directly and ignore the password when the connection is started.

A .ssh folder appears in the user directory

There are two files under the directory

Id_rsa.pub is the key of ssh. Copy the contents to sshkey in your github account. This setting option is in "ueser-setting".

After adding it, use the command ssh-T git@github.com to test. If the returned information is correct, the setting is successful.

4. Set up the connection between vscode working directory and git

1) first of all, a new project must be created in github, such as demo, so I won't go into detail about this.

2) in the terminal of vscode, enter git remote add origin git@github.com: your user name / project name (e.g. demo)

3) enter git push-u origin master in the push workspace, and if the push is successful, you will see your project on the website.

4) after that, you only need to upload it in the menu in vscode, and you are done.

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

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