Connect local Git to Github by Gitbash

Gitbash Config

1
2
$ git config --global user.name "yourname"
$ git config --global user.email "gitemail.com"

SSH keys

1
$ ssh-keygen -t rsa -C "gitemail.com"

Connect your remote Github

1
2
3
4
5
$ vi ~/.ssh/id_rsa.pub

~~~~~~~~~~~~~~~~~~~~
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDNKcbNShMsXf*********************Q1UgyuXcWXZouLaETAsHrQ1trQOevAYuUR+kqzwO73+PJRF2G15ffpoVdmgb+XZqpSl/p5wWUyvYwRSm***********************Hi468= gitemail.com
~~~~~~~~~~~~~~~~~~~~

paste your local public key to your Git

1
2
3
$ ssh -T git@github.com

$ You've successtully authemticated

How to use the sshd service in gitbash on Windows

It’s very convenient to use the gitbash shell on windows to start your sshd service.
Based on this, we can use the scp or rsync to transport files between differenct OS such as IOS, Linux and Windows.

1
2
3
$ ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
$ ssh-keygen -t rsa -f /ect/ssh/ssh_host_rsa_key
$ /usr/bin/sshd

You can use ssh name@192.168.1.1 to connect a remote server.
You can also pase the ~/.ssh/id_rsa.pub to the authorized_keys on remote server to relized the automatic login.