Skip to content

Latest commit

 

History

History
52 lines (44 loc) · 2.09 KB

git-ssh-vscode-bitbucket.md

File metadata and controls

52 lines (44 loc) · 2.09 KB

Setting Up Git SSH in VS Code with Git Bash for Bitbucket

1. Check for Existing SSH Keys in Git Bash

Open Git Bash and check for existing keys by running the following command:

ls -al ~/.ssh

Look for files named id_ed25519 and id_ed25519.pub.

2. Generate a New SSH Key Pair

If you don't have an existing key, generate a new one by running the following command:

ssh-keygen -t ed25519 -C "[email protected]"

Make sure to replace [email protected] with your actual email address.

3. Add Your SSH Public Key to Bitbucket

  • Display and copy your public key using Git Bash by running the following command:
cat ~/.ssh/id_ed25519.pub
  • Log into your Bitbucket account.
  • Go to: Avatar (bottom left) > Personal settings > SSH keys.
  • Click on the "Add key" button and paste your public key.

4. Test the Connection in Git Bash

Test the connection by running the following command in Git Bash:

If you see a welcome message, it means that the connection was successful.

5. Configure Git in VS Code to Use SSH (if needed)

  • In VS Code, press Ctrl + Shift + P to open the command palette.
  • Type and select "Git: Clone".
  • Enter the SSH URL of the Bitbucket repository. It should look like: [email protected]:username/reponame.git
  • Make sure to replace username and reponame with your actual username and repository name.
  • Select a directory for your repository.

6. Troubleshooting

If VS Code doesn't recognize Git Bash, ensure that it's set as the integrated terminal by following these steps:

  • Open the command palette in VS Code (Ctrl + Shift + P).
  • Search for and select "Preferences: Open User Settings".
  • Navigate to "Terminal > Integrated > Shell: Windows" and set the path to the Git Bash executable, typically: C:\\Program Files\\Git\\bin\\bash.exe.

Ensure that the SSH agent has the right key in Git Bash by running the following commands:

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

That's it! You can now enjoy password-less Git operations with Bitbucket in VS Code using Git Bash. 😊