Search code examples
gitgithubvisual-studio-codeconnectionssh-keys

Connecting Github to VS Code on MacBook Pro


I'm want to connect my github account to vs code and have tried various things. I made sure the email I added in my terminal was the same one in my account settings. I've tried adding an ssh key (which I might've done wrong since I'd never done that before). I added the Gitlens extension, logged into my account, then deactivated and reactivated git in vs code.

I created a repository in vs code and made two commits. Everything shows up in vs (except that my commits don't show up in the timeline). I tried opening a repository I created on github in vs code and that didn't work either.

How do I get the two to communicate together? Thanks.


Solution

  • Creating commits on VSCode has no bearing on a remote GitHub repository.

    You would need to push them ("Sync") in order for them to be published.

    What you should do is:

    • make sure your SSH key is recognized: ssh -Tv git@github.com
    • make sure you have created an empty repository on GitHub
    • go to your local repository folder
    • type git remote add origin git@github.com:Me/MyNewProject
      (Replace "Me" with your GitHub user account name, and MyNewProject with a more meaningful name)
    • go back to VSCode, and click on the "Sync" button

    You should see your commits on GitHub.