Enhancing Skills

Setting Up Git and GitHub with VS Code

If you’re looking to streamline your development process with Git and GitHub in Visual Studio Code, this guide will help you uninstall any previous installations, set up the latest tools, and walk you through cloning a repository and making your first commit.

Step 1: Uninstall Existing Git and GitHub Programs, & Credentials

Before installing the new versions, it’s a good idea to remove any previous installations that may cause conflicts. Here’s how to do that:

  1. Uninstall Programs:
    • Open the Control Panel: Search for “Control Panel” in the Windows search bar.
    • Uninstall any existing Git and GitHub programs.
  2. Remove Credentials:
    • Navigate to Credential Manager: Go to User Accounts and select Credential Manager.
    • Manage Windows Credentials: Click on the “Windows Credentials” tab.
    • Delete Unnecessary Git Credentials: Remove any Git-related credentials that are no longer needed.

Step 2: Install Git and GitHub Desktop

With the old installations out of the way, you can now proceed with installing the latest versions of Git and GitHub Desktop:

  1. Download Git: Install version 2.47.0 (64-bit) or higher from the official Git website.
  2. Download GitHub Desktop: Download the GitHub Desktop Setup (x64) from the official GitHub Desktop website.
  3. Follow the Prompts: Go through the installation prompts for both applications until they are fully installed.

Step 3: Launch GitHub Desktop

Once everything is installed, open GitHub Desktop:

  1. Launch GitHub Desktop: Find it in your applications and open it.

Step 4: Clone a Repository

Now it’s time to clone a repository from GitHub:

  1. File Menu: In GitHub Desktop, go to File and select Clone Repository.
  2. Copy Repository Link: Navigate to your GitHub account in a browser, find the repository you want to clone, and copy the HTTPS link.
  3. Follow the Prompts: Paste the link into GitHub Desktop and follow the prompts to complete the cloning process.

Step 5: Open the Repository in Visual Studio Code

After successfully cloning the repository, you can open it in Visual Studio Code:

  1. Open in VS Code: Click the option to “Open in Visual Studio Code” in GitHub Desktop.

Step 6: Make a Simple Change

Now it’s time to make a small change to verify that everything is working properly:

  1. Edit the Code: Open any file in the repository and make a simple change, like adding a comment.

Step 7: Commit and Push Your Changes

Once you’ve made your change, it’s time to save it back to the repository:

  1. Click the Source Control Icon: In Visual Studio Code, find and click the Source Control icon in the sidebar.
  2. Add a Commit Message: Enter a brief message describing your change.
  3. Commit the Change: Click the “Commit” button to save your changes locally.
  4. Push to GitHub: Finally, click the “Push” button to send your changes to the remote repository on GitHub.

Conclusion

By following these steps, you’ve successfully set up Git and GitHub with Visual Studio Code, cloned a repository, made a change, and pushed it back to GitHub. With this workflow in place, you’re ready to take on more complex projects and collaborate effectively! Happy coding!


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.