Skip to main content


Integrating GitHub with Visual Studio Code to Publish Your Salesforce Project



As we all know, version control plays a crucial role in managing projects efficiently. GitHub, a popular platform for version control, provides a seamless collaboration experience. Salesforce developers often leverage GitHub to maintain their code repositories and collaborate with other team members. In this blog post, we will explore how to integrate GitHub with Visual Studio Code (VSC) and publish your Salesforce project using a Personal Access Token (Classic).


Before getting started, ensure that you have the following prerequisites in place:

  • A GitHub account: If you don’t have a GitHub account yet, you can sign up for a free account at Visit the website and click on the “Sign up” button to create your account. Provide the necessary information, including your username, email address, and password. Once you have completed the sign-up process, you’ll have access to your GitHub account.
  • Visual Studio Code: Visual Studio Code (VSC) is a lightweight, open-source code editor that provides a rich set of features for Salesforce development. To install VSC, visit the official Visual Studio Code website at Choose the appropriate download for your operating system (Windows, macOS, or Linux) and follow the installation instructions. Once installed, you can launch VSC from your applications or desktop.
  • Salesforce CLI: Salesforce CLI is a command-line interface that allows developers to interact with Salesforce orgs, develop customizations, and manage projects. To install Salesforce CLI, you can visit the Salesforce CLI GitHub repository at Follow the installation instructions provided for your specific operating system. Once installed, you can access Salesforce CLI from your terminal or command prompt by running the sfdx command.

Having these prerequisites in place will enable you to seamlessly integrate GitHub with Visual Studio Code and Salesforce CLI, empowering you to efficiently manage your Salesforce projects and collaborate with your team.

Step 1: Install and Configure GitHub Extension for Visual Studio Code:

  1. Open Visual Studio Code and navigate to the Extensions view.
  2. Search for “GitHub” in the marketplace and install the “GitHub Pull Requests and Issues” extension.

3. Once installed, click on the extension and authorize GitHub access by signing in with your GitHub credentials.


Step 2: Initialize Your Salesforce Project:

  1. Open a terminal window in Visual Studio Code by navigating to View > Terminal.
  2. Use Salesforce CLI to authenticate with your Salesforce org and create a new project.
  3. Change to your project’s directory using the command ‘cd <project_directory>‘.
  4. Initialize a new Git repository in your Salesforce project by running ‘git init‘.
  5. Connect your local Git repository to the GitHub remote repository using the command ‘git remote add origin <github_repository_url>‘.

Step 3: Publish Your Salesforce Project:

  1. Create a new branch for your changes using ‘git checkout -b <branch_name>‘.
  2. Make the necessary changes to your Salesforce project using Visual Studio Code.
  3. Stage your changes by running ‘git add .‘ to include all modified files or specify individual files using ‘git add <file_path>‘.
  4. Commit your changes with a descriptive message using ‘git commit -m “Commit message” ‘.
  5. Push your changes to the remote GitHub repository with ‘git push origin <branch_name>‘.

6. Open GitHub in your browser, navigate to your repository, and create a new pull request for your changes.
7. Review the changes, add appropriate comments, and merge the pull request into the main branch.


Integrating GitHub with Visual Studio Code provides a seamless workflow for Salesforce developers to manage their projects efficiently. By following the steps outlined in this blog post, you can easily integrate GitHub, leverage the power of version control, and collaborate effectively with your team. Remember to keep your Personal Access Token secure and avoid sharing it with unauthorized individuals.

In addition to these steps, you can further enhance your Salesforce development workflow by utilizing Git features such as branching, tagging, and code reviews. You can also explore the various Git commands available to manage your project effectively.

Happy collaborating!

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.

Sanket Dudhe

Sanket Dudhe is a Technical Consultant at Perficient. He has an experience of 4+ years as SDET. He loves technology and hence is curious to learn about new emerging technologies #lovefortechnology.

More from this Author

Follow Us