VS Code and git, problems with ssh keys

I kept running into a problem after completely wiping my Mac and reinstalling software: I could not get Visual Studio Code to push or pull to repositories in my GitLab account. It turned out the solution was pretty easy.

Visual Studio Code uses the system git. In my case that git client was installed via Homebrew1. After installing git I neglected to generate an ssh key. More importantly, I neglected to generate the default ssh public/private keypair (files are called id_rsa.pub/id_rsa). Without any other setup this is the public/private keypair that git will use for ssh operations against a remote server.

So the key was generated with:

ssh-keygen -o -t rsa

using the defaults when prompted and not assigning a password.

I then added this key to GitLab by first doing:

pbcopy < ./id_rsa.pub

at the command line (which copies the text in the file to the system clipboard) then pasting it into the proper spot on GitLab.

Problem solved!

Leave a comment

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: