1、設置姓名和郵箱地址
運行Git Bash,進行如下操作:
$ git config --global user.name "your name" //輸入英文名字,然後按回車
$ git config --global user.email "[email protected]" //輸入郵箱地址,然後按回車
通過 $ git config --list 可查看配置列表
姓名和郵箱的配置文件保存在 .gitconfig 文件中
2、提高命令輸出的可讀性
$ git config --global color.ui auto
3、設置 SSH Key
$ ssh-keygen -t rsa -C "[email protected]" //按回車
會顯示以下信息
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/tao1024/.ssh/id_rsa): //此處按回車
Enter passphrase (empty for no passphrase): //輸入密碼
Enter same passphrase again: //再次輸入密碼
最後會生成兩個文件:id_rsa文件是私有密鑰,id_rsa.pub是公開密鑰
4、向GitHub中添加公開密鑰
1)註冊一個GitHub賬戶
2)登陸GitHub賬戶
3)點擊右上角的Settings
4)選擇SSH and GPG keys菜單,點擊 New SSH key
4)