Visual Studio Code (VSCode) is a powerful, lightweight code editor, and Git is a robust version control system. Together, they make for a formidable toolset for modern software development. This guide will walk you through installing VSCode and Git on Windows, setting up a new project, version controlling it with Git, and pushing your project to GitHub.

Part 1: Installation

Installing Visual Studio Code

  1. Download VSCode:
  2. Run the Installer:
    • Execute the downloaded file and follow the installation prompts. I recommend ticking all the checkboxes to integrate VSCode into the shell (context menu integration is particularly handy).

Installing Git

  1. Download Git for Windows:
  2. Run the Git Installer:
    • Open the downloaded file and proceed through the setup. Default settings usually work well, but ensure you select a terminal emulator that you’re comfortable with, and choose to have Git added to your system PATH.

Part 2: Setting Up Your Project in VSCode

  1. Create a New Project Folder:
    • Right-click in the folder where you want your project to live, select “New” -> “Folder,” name it, and navigate into it.
  2. Open the Project in VSCode:
    • Right-click within your new folder and select “Open with Code” to open the folder as a project in VSCode.
  3. Create Your Project Files:
    • In VSCode, go to File -> New File to create new files such as index.html, app.js, or whatever your project requires. Save them with the appropriate extensions.

3: Initialize Git Repository

Initializing Your Project with Git

  1. Open the Integrated Terminal in VSCode:
    • Use the shortcut Ctrl + `` (backtick) or navigate to Terminal->New Terminal` from the top menu.
  2. Initialize Git:
    • In the terminal, type: git init
    • This command creates a new .git directory in your project folder, which Git uses to track changes.

Adding Files to Source Control

  1. Add New Files to Git:
    • After creating your files, use the command: git add .
    • The period . adds all new and changed files to the staging area, preparing them for a commit.
  2. Commit the Changes:
    • Save your staged changes with a message: git commit -m "Initial project setup"
    • Good commit messages are short yet descriptive, conveying the purpose of the changes.

Part 4: Pushing to GitHub

Creating a Repository on GitHub

  1. Create a New Repository:
    • Go to GitHub and log into your account.
    • Click on the “+” icon in the top right corner, then select “New repository”.
    • Name your repository, choose its visibility (public or private), and leave all other options unchecked for an existing project. Click “Create repository”.

Linking Your Local Repository to GitHub

  1. Add Remote Repository in VSCode:
    • GitHub will provide a URL for your new repository. Copy this URL.
    • Back in VSCode’s terminal, link your local repository to the GitHub repository with: git remote add origin YOUR_REPOSITORY_URL
    • Replace YOUR_REPOSITORY_URL with the one provided by GitHub.
  2. Push to GitHub:
    • Now, push your code with: git push -u origin master
    • This sets the remote origin as the default upstream for your local master branch.

Checking the Status and Troubleshooting

  • Git Status:
    • To ensure that all your files are added and committed, use: git status
    • This command lists all the files that are staged, unstaged, or untracked.
  • Troubleshooting Push Issues:
    • If you encounter errors when pushing, make sure:
      • You have internet connectivity.
      • Your GitHub URL is correct.
      • You have permission to push to the GitHub repository.
    • If you are asked for credentials, ensure you provide your GitHub username and password. If you have two-factor authentication (2FA) enabled, you’ll need to use a personal access token.


Congratulations! You’ve now set up Visual Studio Code, initialized a Git repository for your project, and pushed your project to GitHub. This setup provides a solid foundation for version control and collaboration for your development projects. Remember to commit often, write meaningful commit messages, and regularly push your changes to GitHub. Happy coding!