---
schema_version: "1"
id: a9ec69d7c373ad9b598de5e64cb2cf7bfef37dedb184c4a1c9f70cdd98da6453
title: Add Project to Source Control
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfvscode/guides/add-project-to-source-control.md
canonical_url: https://developer.salesforce.com/docs/platform/sfvscode-extensions/guide/add-project-to-source-control.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: f328fc9c9ce39675a2589e2ff62ccb607955a80e2b57a5558d1af8ff4a6d3232
products:
  - Salesforce Extensions for Visual Studio Code
  - salesforcedx
---
# Add Project to Source Control

The Activity Bar enables you to initialize a repository from a project and publish the repository to GitHub. Alternatively, Open the Command Palette (⇧⌘P) and search for "git" to view git commands.

**note:** You must have a GitHub account as a prerequisite to adding a project to a GitHub repo.

To add a project to a GitHub repo:

1. Click the Source Control icon (![Source Control icon](https://developer.salesforce.com/docs/media/codebuilder/icon_source_control.png)) in the Activity Bar.
2. Click **Initialize Repository**.
3. In the Message field, add a commit message, such as "initialize project repo".
4. Click **Commit**.
5. Click **Yes** in the window asking "Would you like to stage all your changes and commit them directly?"
6. Click **Open Git Log** in the window that says "Make sure you configure your "user.name" and "user.email" in git."
7. Click the Terminal subtab and run the following commands after you substitute values for _you@example.com_ and _Your Name_:

```text
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
```

8. In the Activity Bar, enter the commit message again and click **Commit**.
9. Click **Publish Branch**.
10. Click **Allow** in the window that says "The extension 'GitHub' wants to sign in using GitHub."
11. Click **Copy & Continue to GitHub**.
12. Click Open to open GitHub in your browser.
13. Paste the copied code and click **Continue**.
14. If prompted for Single sign-on to your organizations, click **Continue**.
15. If prompted, click **Authorize Visual-Studio-Code**.
16. Complete logging in to GitHub. If two-factor authentication is configured for your GitHub account, you may be asked for a two-factor code.
17. In VS Code, choose to "Publish to GitHub private repository". Alternatively, choose "Publish to GitHub public repository" if you want to make the repo available to anyone. If in doubt, choose the private repo.

Your project is now saved in GitHub.
