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
.
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.
- 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.
Test the connection by running the following command in Git Bash:
ssh -T [email protected]
If you see a welcome message, it means that the connection was successful.
- 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
andreponame
with your actual username and repository name. - Select a directory for your repository.
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. 😊