Set up an SSH key เพื่อใช้ Clone ขึ้น EC2

14 ก.พ. 2019 , 2,995 Views   , หมวดหมู่ AWS Git   ,


ล็อกอินด้วย user ssh

Set up your default identity

  • From the terminal, enter ssh-keygen at the command line.
    The command prompts you for a file to save the key in:

    Generating public/private rsa key pair.
    Enter file in which to save the key (/Users/emmap1/.ssh/id_rsa):
  • Press the Enter or Return key to accept the default location.
  • Enter and re-enter a passphrase when prompted.
  • หน้าแสดงผลก็จะประมาณนี้ครับ
  • List the contents of ~/.ssh to view the key files.

Add the key to the ssh-agent

  • To start the agent, run the following:
  • Enter ssh-add followed by the path to the private key file:

 Add the public key to your Bitbucket settings

  • In your terminal window, copy the contents of your public key file. If you renamed the key, replace id_rsa.pub with the public key file name.
  • Copy Key ไปใส่ใว้ใน Bitbucket ดังรูป

จากนั้นก็ทำการ Clone มาที่ Server

* ใส่ . ตามหลังเพื่อไม่ให้ เอาโฟลเดอร์ของ Project มาด้วย

 

ดูเพิ่มเติม

https://serverfault.com/questions/737595/git-clone-from-bitbucket-org-on-ec2-server-using-ssh-keys

https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html#SetupanSSHkey-ssh2