Push and Pull to git with using SSH Keys

Ever experience that every time you pull or push to bitbucket it ask you to enter password if not both username and password?

Theres a better way to push and pull to git using ssh.

  • Generate public and private keys
$> ssh-keygen -t rsa 

If you already created ssh keys before then just copy the content of the public key

$> cat ~/.ssh/id_rsa.pub

If you are using bitbucket, go to settings

https://bitbucket.org/account/user/{yourusername}/ssh-keys/

and create ssh key the you copy

Add SSH Key
Add SSH Key

Take note to use the “SSH” version before cloning. or if you’re already using HTTPS, just edit git/config then replace the URL.

$> nano .git/config
[core]
 repositoryformatversion = 0
 filemode = true
 bare = false
 logallrefupdates = true
[remote "origin"]
 url = git@bitbucket.org:myteam/repo.git
 fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
 remote = origin
 merge = refs/heads/master

Install Linux, Nginx, MySQL, PHP (LEMP stack) in Ubuntu 16.04

So you want to install LEMP in your server. In my experience, when I want to set up server for my web app I always install LEMP stack. Sometimes it will consume a lot of your time.

So I created a simple script that we can run to install all packages required for our server.

Login to your Ubuntu server using SSH

Download the file and make it runnable

https://gist.github.com/mannysoft/e4b54662b3aec5c0b1b88be52177ab68

Make the file runnable

chmod +x install.sh

Run the script

./install.sh