Hello Coders,
In today's tutorial, I am going to show you How to use Git and GitHub inside VS Code Editor.
Basic Setup
Start by creating a new folder and naming it as you prefer. Then, open the folder in the VS Code Editor.
Next, create a new file within this folder, such as `index.html`, or choose any name you like. We'll use this file to make changes and demonstrate how Git and GitHub work within the VS Code Editor.
After that, add a basic HTML boilerplate to the `index.html` file by pressing `Shift + 1`.
Create a GitHub repository
Let's create a new GitHub repository directly within the VS Code Editor. You no longer need to visit the official GitHub site to create a repository.
First, click on the Source Control icon in the left sidebar or press Ctrl + Shift + G
to open the Source Control panel. It should look like this.
Next, click on the 'Publish to GitHub' button. This will open a dialog box that looks like this.
and then click on the allow button, this will allow the GitHub extension to sign in using your GitHub account.
Afterward, a window will open in your browser to authorize your GitHub account. Simply click on the 'Continue' button, followed by the 'Authorize' button to grant access.
Now, your GitHub account is set up within the VS Code Editor. Returning to VS Code, you'll see a dialog box like this.
First, enter your project name or leave it as the default. Next, select the repository type.
To create a public repository, click on 'Publish to GitHub Public Repository.' If you prefer a private repository, click on 'Publish to GitHub Private Repository.
Your GitHub repository is now created. If you'd like to verify it, navigate to the repository section of your GitHub account.
At this point, your Source Control tab in VS Code should look like this.