Git on Bitbucket: Always asked for password, even after uploading my public SSH key

前端 未结 15 1279
情书的邮戳
情书的邮戳 2020-12-22 17:32

I uploaded my ~/.ssh/id_rsa.pub to Bitbucket\'s SSH keys as explained, but Git still asks me for my password at every operation (such as git pull).

15条回答
  •  有刺的猬
    2020-12-22 17:52

    Are you sure you cloned it using the ssh url?

    The url for origin says url = https://Nicolas_Raoul@bitbucket.org/Nicolas_Raoul/therepo.git so if it is using https it will ask for password irrespective of your ssh keys.

    So what you want to do is the following:

    open your config file in your current repo ..

    vim .git/config

    and change the line with the url from

    [remote "origin"]
            fetch = +refs/heads/*:refs/remotes/origin/*
            url = https://Nicolas_Raoul@bitbucket.org/Nicolas_Raoul/therepo.git
    

    to

    [remote "origin"]
            fetch = +refs/heads/*:refs/remotes/origin/*
            url = git@bitbucket.org:Nicolas_Raoul/therepo.git
    

提交回复
热议问题