Remote repository github dengan menggunakan SSH Key:
- Generate SSH Key (RSA 2048bit)
ssh-keygen -t rsa -b 2048 -C "[email protected]"
- Masukkan public key dari key pair yang digenerate sebelumnya di Profile github
Konfigurasi SSH client di local development machine anda via ~/.ssh/config
# ~/.ssh/config - create apabila belum ada
Host github.com-user1
User git
Hostname github.com
IdentityFile '~/.ssh/user1privatekey'
Host github.com-user2
User git
Hostname github.com
IdentityFile '~/.ssh/user2privatekey'
Berdasarkan konfigurasi di atas maka ssh github.com-user1
akan melakukan upaya login ke github.com dengan user git dan private key user1 sebagaimnana didefinisikan di dalam file konfigurasi ssh
Remote Repo di repo lokal dapat ditambahkan melalui perintah berikut dengan asumsi repository lokal sudah disetup
$ cd /path/to/lokal/repo
$ git remote add origin ssh://git.521000.best-user1/usernamegithub/repo-github.git
Sesuaikan informasi user git di dalam repo lokal untuk digunakan ketika melakukan commit dan push
$ git config --local user.name "username1"
$ git config --local user.email "[email protected]"