在windows上生成ssh key,关联bitbucket服务器

在windows上生成ssh key

可以选择进入电脑C盘文件夹,空白处右键选择 git bash 弹出下边弹框(如果没有该选项就需要在电脑上安装git bash),输入 ssh-keygen -t rsa -C "youremail@email.com"回车,引号中是你在bitbucket上的注册邮箱地址,然后会要求设置ssh key的名称、密码和确认密码,都可以为空直接回车,最后在~/.ssh文件夹(C:\Users\username\.ssh)下生成了两个文件id_rsa和id_rsa.pub分别存放私钥和公钥

查看现有ssh key

在bitbucket上设置公钥

进入管理账户页面点击左侧SSH keys,这里展示了邮箱和ssh的列表,可以新增和删除

将id_rsa.pub文件内容复制到新增弹框中点保存,就成功添加了ssh key

在webstorm中关联bitbucket上的项目

点击项目左侧克隆,在已经添加了 ssh key 后会显示 ssh 仓库地址,复制该地址到 webstorm->git->remotes 中即可

打开git remotes进行配置

执行 git fetch 获取最新的远程分支,可以看到已经获取到了bitbucket上的分支

转载于:https://juejin.im/post/5c32e9fa51882526093f73f8

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Bitbucket supports SSH as a secure protocol for accessing and managing your repositories. To use SSH with Bitbucket, you need to generate an SSH key pair and add the public key to your Bitbucket account. Here are the steps to set up SSH access with Bitbucket: 1. Generate an SSH key pair on your local machine if you don't have one already. You can use the `ssh-keygen` command to generate the key pair. ```bash ssh-keygen -t rsa -b 4096 -C "your_email@example.com" ``` This command will prompt you for a location to save the key pair and a passphrase (optional). Press Enter to accept the default values. 2. Once the key pair is generated, copy the public key to the clipboard using the following command: ```bash pbcopy < ~/.ssh/id_rsa.pub ``` If you're not on macOS, you can manually open the `id_rsa.pub` file and copy its contents. 3. Log in to your Bitbucket account and navigate to your avatar in the bottom left corner and click on "Bitbucket settings." 4. In the left-hand sidebar, click on "SSH keys" under the "Security" section. 5. Click on the "Add key" button. 6. Paste the copied public key into the "Key" field and provide a label for the key (e.g., "My SSH Key"). 7. Click on the "Add key" button to save the SSH key. Once you have set up SSH access, you can clone your repositories using the SSH URL. For example: ```bash git clone git@bitbucket.org:username/repository.git ``` Make sure to replace `username` with your Bitbucket username and `repository` with the name of your repository. That's it! You should now be able to use SSH to access your Bitbucket repositories.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值