Skip to content

Instantly share code, notes, and snippets.

@rohankhudedev
Last active February 3, 2023 07:30
Show Gist options
  • Save rohankhudedev/8791905090d959812c12ff4e768ed279 to your computer and use it in GitHub Desktop.
Save rohankhudedev/8791905090d959812c12ff4e768ed279 to your computer and use it in GitHub Desktop.
How to create pipelines

Initial Step

  • Clone repository manually in the server. Use SSH URL to clone

Step 1 - Server

  • run this command ssh-keygen or ssh-keygen -t rsa -b 4096 -C "your_email@domain.com"
  • copy id_rsa.pub to authorized_keys by doing below
    • cd ~/.ssh/
    • cp id_rsa.pub authorized_keys
  • copy settings in ~/.ssh/config
Host bitbucket.org
  IdentityFile ~/.ssh/id_rsa
  ServerAliveInterval 600
  TCPKeepAlive yes
  IPQoS=throughput

Step 2 - Bitbucket

  • Enable pipeline
  • Add above generated SSH keys for pipeline section in repository settings
    • Goto Repository Settings -> Pipelines -> SSH keys
    • Copy private and public key
  • Add server host in known hosts lists
    • Add server IP and click on fetch. If you have other port that 22, then use SERVER_IP:PORT.
  • Add public key to Profile Account Settings as well here

Step 3 - Server

  • Check all the files in ~/.ssh has proper file permissions. Refer
  • run command ssh -Tv git@bitbucket.org. This will create known_hosts file in ~/.ssh. Dont forget to change permission of known_hosts
    • Expected Output
    authenticated via ssh key.
    You can use git to connect to Bitbucket. Shell access is disabled
    
    • If not configured properly and mostly error will be
    git@bitbucket.org: Permission denied (publickey).
    
    Reason for this can be - missing public key in account settings

Final Step - Add Deployment variables in repo settings : Repository settings -> Pipelines -> Deployments

Pipelines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment