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

Notes on the methods and steps of configuring Git in VSCode

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Git is integrated in vscode, and many operations can be done with a click without writing some git instructions.

However, this requires you to configure vscode. Next I will talk about the configuration of git and password-free upload github.

1. Install Git management tools, which can be installed on the official website. The installation path is https://git-scm.com/. The installation path defaults to C:\ Program Files\ Git and can be modified by yourself. Here I install it at D:\ Program Files\ Git.

Second, after installing Git, if the information of the environment variable path path is configured in the figure, it will generally be configured successfully automatically, and after the configuration is completed, the computer can use Git.

If you want to use Git in VS Code, you need to configure git.path in the editor

Configuration steps: in the editor file-> preferences-> Settings-> search git.path- > Click Edit-> find the installation directory of git on your computer, find the bin folder inside, and copy the full path of the file in the git.exe file.

Fourth, the use of Git in VSCode and secret-free upload of Github.

First, set the global variable. The following command can be entered directly on the git-bash terminal. After success, a .gitconfig configuration file containing your user name and password will be generated under your computer user and directory.

Git global settings:

Git config-global user.name "user name" git config-global user.email "user mailbox"

Here because I set the terminal to the git-bash terminal for convenience, here is the tutorial

Or search for the following fields in the default user settings

Terminal.integrated.shell.windows

Then copy the bash.exe file directory in the bin folder under the installation directory and update it to the user settings as shown in the figure

After setting up, you can use the shortcut key Ctrl+~ to open the terminal.

The next step is to upload the code to github

Create a library on github before uploading, that is, put the project file library as shown in the figure

After the creation is completed, enter vscode and open the terminal to enter the root directory of the project to be uploaded

Then execute the git initialization warehouse command git init

Execute the command to add file directory to git warehouse, git add. (. The decimal point is to add all files in the current directory or you can add only defined files or folders)

Execute the upload to git warehouse command git commit-m "writable comment content"

Execute the git warehouse and github warehouse connection command git remote add origin https://github.com/ your github user name / test.git (here is the warehouse name you created plus .git)

Execute the command git push-u origin master that is pushed to the branch (master) (branch name master is the primary branch)

When you click push or execute the previous push command when you use it for the first time, the login box of github will pop up and enter the username and password (enter the username and password for each push in vscode. Here you can execute the git command to let the git software remember the password) as follows

Git config-global credential.helper store

At this point, you can go to github to view the new github warehouse you just built. Click inside and you will see your project, success.

Because vscode integrates with git, some buttons of vscode can replace the git command entered above, as shown in the figure:

The following figure is recommended when you update the code. For the first time, I recommend using the git command throughout the process.

The steps to download the code from github to your computer are as follows:

Based on the fact that I have integrated the git-bash terminal on vscode, you can directly open the editor, open the folder you want to store, ctrl+~ open the terminal, and enter commands directly.

Git clone http://github.com/ username / project name of the clone you want on github

So waiting for the download to complete the code will be on your computer.

If there is no integrated terminal, open the git-bash terminal, enter the command to enter the address you want to store (cd folder name), and then execute the above clone command again.

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