Home  >  Article  >  Development Tools  >  How to upload vscode code to gitee

How to upload vscode code to gitee

PHPz
PHPzOriginal
2023-03-29 11:50:418320browse

If you are a developer, you will definitely use a code editor. Among them, VS Code is a popular open source editor that allows developers to easily write code and perform version control. At the same time, Gitee is a popular domestic code hosting platform that allows you to store code in remote warehouses and share it with others. Here's a simple guide on how to upload your VS Code code to Gitee:

Step 1: Install Git

If you don't have Git installed yet, you'll need to download and install it first . Download address: https://git-scm.com/downloads

Note: If you are using a Mac or Linux system, you can use the pre-installed Git version.

Step 2: Create a Gitee repository

If you don’t have a Gitee account yet, you need to register an account first. The specific steps are as follows:

  1. Open the Gitee homepage https://gitee.com/
  2. Click the "Register" button, fill in the required information and create an account.
  3. Log in to your Gitee account, click the "New" button, select "New Repository"
  4. Fill in the warehouse name, description and other information in the pop-up window, and click the "Create repository" button.

Step 3: Clone the code locally

Before this, you need to create a directory locally and open this directory in VS Code. The specific steps are as follows:

  1. Open a terminal window (use Git Bash for Windows, use Terminal for Mac and Linux).
  2. Enter the following command to clone your Gitee repository:

    • git clone https://gitee.com/[username]/[repository name] .git
    • For example: git clone https://gitee.com/xxx/yyy.git
  3. A prompt will appear box, you need to enter your Gitee username and password.

Please note that at this time you need to replace Username and Repository Name with the actual values ​​you created on Gitee.

Step 4: Open the locally cloned warehouse in VS Code

  1. Open the VS Code editor and click the menu "File" > "Open Folder".
  2. Select the local directory you just cloned.

Step 5: Make changes in VS Code and submit the code

  1. Make changes to the code in the VS Code editor and save it.
  2. Through the VS Code built-in terminal, use the following command to submit the code to the local repository:
git add .  
git commit -m "commit message"

Please replace commit message with the appropriate message.

Step 6: Push local changes to the Gitee repository

  1. Use the following command to push local changes to the Gitee repository:
git push -u origin main

Please note that, The main here should be replaced with the default branch name in the Gitee repository.

  1. A prompt box will appear, requiring you to enter your Gitee username and password for authentication.

Summary

The above are some simple steps to upload VS Code code to Gitee. In addition, there are some other steps and techniques for more complex needs, such as how to merge branches and so on. But for most simple projects, the above steps should be enough for your needs. Hope this article can be helpful to you!

The above is the detailed content of How to upload vscode code to gitee. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn