打开git bash就是git自带的终端,输入ssh
Rc3@ppjun MINGW64 ~/Desktop
$ ssh
usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-E log_file] [-e escape_char]
[-F configfile] [-I pkcs11] [-i identity_file]
[-L address] [-l login_name] [-m mac_spec]
[-O ctl_cmd] [-o option] [-p port]
[-Q cipher | cipher-auth | mac | kex | key]
[-R address] [-S ctl_path] [-W host:port]
[-w local_tun[:remote_tun]] [user@]hostname [command]``
这是代表你已安装ssh。
输入命令ssh-keygen -t rsa生成ssh密钥,连续按三个Enter
Rc3@ppjun MINGW64 ~/Desktop
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Rabbit/.ssh/id_rsa):
打开C:\Users\Rabbit.ssh 找到id_rsa.pub 复制里面的https://github.com/settings/keys 点击 new SSH key的key里面-保存。
最后输入ssh -T git@github.com,结果如下代表你添加好SSH到你git上面了。
Rc3@ppjun MINGW64 ~/Desktop
$ ssh -T git@github.com
Hi gdmec07120731! You've successfully authenticated, but GitHub does not provide shell access.
--global是对用户所有项目生效
用例如以下的公式
git config --global alias.co checkout //用git co 代替 git checkout
git config --global alias.st status //用git st 代替 git status
git config --global alias.br branch
git config --global alias.cm commit
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
//配置log