http://www.git-scm.com/download/git
http://download.tortoisegit.org/github
https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/算法
指南shell
1. Getting Started
2. Git Basics
3. Git Branching
4. Git on the Server
5. Distributed Git
6. GitHub
7. Git Tools
8. Customizing Git
9. Git and Other Systems
10. Git Internalsbash
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
$ ssh-keygen ? Too many arguments. usage: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa] [-N new_passphrase] [-C comment] [-f output_keyfile] ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile] ssh-keygen -i [-m key_format] [-f input_keyfile] ssh-keygen -e [-m key_format] [-f input_keyfile] ssh-keygen -y [-f input_keyfile] ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile] ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile] ssh-keygen -B [-f input_keyfile] ssh-keygen -D pkcs11 ssh-keygen -F hostname [-f known_hosts_file] [-l] ssh-keygen -H [-f known_hosts_file] ssh-keygen -R hostname [-f known_hosts_file] ssh-keygen -r hostname [-f input_keyfile] [-g] ssh-keygen -G output_file [-v] [-b bits] [-M memory] [-S start_point] ssh-keygen -T output_file -f input_file [-v] [-a rounds] [-J num_lines] [-j start_line] [-K checkpt] [-W generator] ssh-keygen -s ca_key -I certificate_identity [-h] [-n principals] [-O option] [-V validity_interval] [-z serial_number] file ... ssh-keygen -L [-f input_keyfile] ssh-keygen -A ssh-keygen -k -f krl_file [-u] [-s ca_public] [-z version_number] file ... ssh-keygen -Q -f krl_file file ...
Secure Shell key generator 工具,-t 指定加密算法類型(type),-b 指定密鑰位數(bit) ,-C 註釋(comment)ssh
eval $(ssh-agent -s)
單獨執行 ssh-agent -s 會獲得命令行,而後再經過eval 執行這些命令行才能真正啓動 ssh-agent,有點相似 js裏的evalide
ssh-add ~/.ssh/id_rsa
若是提示 Could not open a connection to your authentication agent. 說明ssh-agent沒有成功啓動工具
Settings -> SSH AND GPG keys -> New SSH key優化
git clone git@github.com:witaste/ztest.git
補充:經常使用工具類所在目錄結構加密
│ git-bash.exe │ git-cmd.exe │ ├─cmd │ start-ssh-agent.cmd │ start-ssh-pageant.cmd │ └─usr ├─bin │ │ ssh-add.exe │ │ ssh-agent.exe │ │ ssh-keygen.exe │ │ ssh-pageant.exe
由於每次啓動 git-bash ,都須要啓動一個新的 ssh-agent ,並且舊的不能用 ,能不能實現自動化呢,就是每次打開 Git Bash 就會自動打開ssh-agent而且自動將私鑰添加到ssh-agent,答案是有
經過 GitHub Desktop 自帶的 Git Shell 可自動完成
添加自動化腳本
在當前用戶目錄(~)下建立 .profile 文件,內容是
env=~/.ssh/agent.env agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; } agent_start () { (umask 077; ssh-agent >| "$env") . "$env" >| /dev/null ; } agent_load_env # agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?) if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then agent_start ssh-add elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then ssh-add fi unset env
安裝TortoiseGit 經過Pageant 軟件加載PuTTY 形式的私鑰
1)生成 .ppk (能夠經過PuTTYgen 生成新的密鑰對,也能夠load原有的私鑰,轉換成ppk)
2) 經過 Pageant 工具加載 ppk
補充:tortoiseGit 目錄結構
│ ├─bin │ pageant.exe │ puttygen.exe