Git is a tool that every programmer needs. This article will show you how to combine Git and Vscode to manage your projects. You are already a mature git user and should commit your own code.

Step 1: Configure vscode’s Git address

  • Go to VSCode Preferences – Settings – Search git.path to open setting.json
  • Add “git.path”:” git actual installation address”
"git.path": "g:/Program Files/Git/cmd".Copy the code

After adding, open the Git tool in the output column and you can see:

Step 2: Git configures SSH public keys

Command line:

  • Git config –list //
  • Git config –global user.name “butterflylitter” // Set username (-g global)
  • Git config –global user.email “your [email protected]
  • Git config –global credential. Helper store
  • Ssh-keygen -t rsa -c “your [email protected]” // Configure the public key -t: type, rsa: asymmetric encryption

Create a GitHub project

Cloning project

// Clone the project to local git using git gloneclone https://github.com.cnpmjs.org/butterflylittle/git-learn.git
Copy the code

Open the project folder

Create a new index. HTML file and click Source Code Manager

Click + to save a file, click √ submit file, and enter

Enter the account password

Refresh the GitHub project page to see that the file has been added

Configuration of credit certificates

After creating a new project, we have to enter our account and password every time we push a file to GitHub, which is very troublesome. We can set the credit certificate in the following two ways, and then we can directly submit the push.

Method 1: Credential.helper

git config --global credential.helper store
Copy the code

Method 2: ssh-keyGen

This method applies to projects that are cloned in SSH mode

ssh-keygen -t rsa -C "your [email protected]" 
Copy the code

Press enter for three consecutive times, and the following information is displayed

Find the id_rsa.pub file, usually found in C:\Users\usename\.ssh. First, open the file in Notepad and copy the contents. Then find the SSH Settings in GitHub setting, create a new SSH key, and copy the contents of id_rsa.pub to the key.

Once configured, you can submit and push directly to GitHub.

In this paper, to the end.

Thank you for reading, if it helps you, please like and follow. This is the biggest motivation for me to continue writing articles. thank you