Git clone from Bitbucket.org on EC2 server using SSH keys

7,849

You can't clone over HTTPS if you want to use public key authentication. You need to modify the url to the SSH one, like this:

git clone [email protected]/user/repo.git

or

git clone ssh://[email protected]/user/repo.git

should work for you.

Share:
7,849

Related videos on Youtube

Michael Hobbs
Author by

Michael Hobbs

Updated on September 18, 2022

Comments

  • Michael Hobbs
    Michael Hobbs over 1 year

    We have setup a EC2 build server and would like to use SSH keys to clone the repo.

    Steps taken:

    cd ~/.ssh
    ssh-keygen -t rsa
    

    created config:

    host bitbucket.org
     HostName bitbucket.org
     IdentityFile ~/.ssh/bitbucket_rsa
     User git
    

    Loaded public ssh key on bit bucket:

    ssh-rsa ...key... ec2_user@ip-censored

    When:

    git clone https://[email protected]/user/repo.git
    

    It ask for password. What should we check or do to see where we are going wrong?