http://www.git-scm.com/download/ http://www.git-scm.com/download/win http://www.git-scm.com/download/mac https://www.kernel.org/pub/software/scm/git/git-2.19.1.tar.gz https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.19.1.tar.xz Git via Git If you already have Git installed, you can get the latest development version via Git itself: git clone https://github.com/git/git 克隆遠程倉庫 git clone [--recursive] 遠程倉庫地址 [本地路徑] 克隆遠程單分支 git clone --single-branch -b develop 遠程倉庫地址 拉取遠程分支 git checkout -b develop origin/develop 拉取遠程分支2 git fetch origin develop:develop git checkout develop git branch -u origin/develop 建立分支 git checkout -b newbranch git push -u origin newbranch git branch -a 查看分支關聯 git branch -vv 合併newbranch到master分支 git checkout master git branch git merge newbranch git push 刪除分支 git branch -a git branch -d delbranch git branch -r -d origin/delbranch git push origin :delbarnch 建立tag git tag newtag git push origin newtag git tag -l 刪除tag git tag -d deltag git push origin :refs/tags/deltag 修改遠程倉庫地址 $ git remote -v origin git@172.24.10.155:Bob/WorkflowDesigner2.git (fetch) origin git@172.24.10.155:Bob/WorkflowDesigner2.git (push) $ git remote set-url origin git@192.168.0.101:Bob/WorkflowDesigner2.git $ git remote -v origin git@192.168.0.101:Bob/WorkflowDesigner2.git (fetch) origin git@192.168.0.101:Bob/WorkflowDesigner2.git (push) 保存臨時修改 $ git stash 取出臨時修改 $ git stash pop 顯示全部stash $ git stash list 清空stash $ git stash clear 修復最近一次commit $ git commit --amend $ git commit --amend -m "Fixes bug #42" 回退 $ git reset --hard <commit_id> $ git clean -df 移除未被跟蹤的文件,-xf會忽略.gitignore進行移除文件 $ git push origin HEAD --force 參數說明 --mixed 缺省,只保留源碼,回退commit和index信息。 --soft 只回退commit信息 --hard 完全回退到某個版本 HEAD 最近一次提交 HEAD^ 上一次提交。 忽略已經被提交的文件 $ git rm --cached -r logs/ $ vim .gitignore 將 logs/ 加入忽略文件列表 $ git commit -m "We really don't want Git to track this anymore!" 顯示某個變動 git show git show HEAD~ 顯示分支歷史節點 git show-branch 按貢獻值顯示提交 git shortlog git shortlog -s // 按名字統計 git shortlog -s -e // 按郵箱統計 顯示衝突文件 git diff --name-only --diff-filter=U git config --global alias.conflicts "diff --name-only --diff-filter=U" git conflicts 獲取提交ID信息 $ git rev-parse HEAD 356b6cf8ad7f2a3235b0bbeae5f4991816ac8087 $ git rev-parse --short HEAD 356b6cf $ git rev-parse --abbrev-ref HEAD develop 配置全局信息(詳細:https://git-scm.com/docs/git-config) $ git config --global user.name "Bob" $ git config --global user.email "bob@email.com" $ git config --global push.default simple // git config --global push.default matching // 區別是,simple是僅推送當前分支,matching會推送所有分支 $ cat ~/.gitconfig [user] name = Bob email = bob@email.com [push] default = simple $ git config --global core.excludesfile "$HOME/.gitignore_global" $ cat ~/.gitignore_global *~ .DS_Store .idea # some comment. 設置git默認編輯器: $ git config --global core.pager 'less' # 相似vim(建議) $ git config --global core.pager 'more' # 輸出到shell並分頁 $ git config --global core.pager 'vim -' # vim(不支持着色標記) $ git config --global core.pager 'nano -' # nano(不支持着色標記) 注:Windows的Git Console的less跟linux的more效果相同,並且沒有more命令。 HTTP代理配置 格式:git config --global http.https://domain.com.proxy http://proxyUsername:proxyPassword@proxy.server.com:port 好比:git config --global http.https://gitlab.com.proxy http://10.124.124.124:80 SSH代理配置 $ vim ~/.ssh/config # 添加內容: Host *.gitlab.com ProxyCommand connect -H 10.124.124.124:80 %h %p ServerAliveInterval 30 配置SSH $ ssh-keygen -t rsa -b 4096 -C "bob@email.com" $ eval "$(ssh-agent -s)" Agent pid 28728 $ ssh-add -k ~/.ssh/id_rsa // ssh-add -K ~/.ssh/id_rsa $ clip < ~/.ssh/id_rsa.pub // pbcopy < ~/.ssh/id_rsa.pub 若是粘貼github上失敗,去掉最後的一個換行。 查看公鑰的MD5指紋 ssh-keygen -E md5 -lf ~/.ssh/id_rsa.pub 自動啓動ssh-agent和ssh-add # vim ~/.bash_profile // vim ~/.zshrc ------------------------ SSH_ENV="$HOME/.ssh/environment" function start_agent { echo "Initialising new SSH agent..." /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" echo succeeded chmod 600 "${SSH_ENV}" . "${SSH_ENV}" > /dev/null # /usr/bin/ssh-add -k ~/.ssh/your_id_rsa /usr/bin/ssh-add; } # Source SSH settings, if applicable if [ -f "${SSH_ENV}" ]; then . "${SSH_ENV}" > /dev/null #ps ${SSH_AGENT_PID} doesn't work under cywgin ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { start_agent; } else start_agent; fi ------------------------ 更改git鏈接方式https爲ssh 複製好ssh地址,而後打開.git/config文件修改[remote "origin"]下的url Git push/pull fatal: protocol error: bad line length character: This 緣由是服務器端沒爲git用戶配置bash,解決方法是: # sudo usermod -s /bin/bash git GPG配置 備註:Windows安裝:https://gpg4win.org/download.html 其餘系統安裝在此文件後面,能夠搜索GnuPG 1. 查看已有的GPG keys $ gpg --list-secret-keys --keyid-format LONG 2. 建立一個GPG key $ gpg --full-generate-key 3. 導出GPG public key爲文本格式 $ gpg --list-secret-keys --keyid-format LONG sec rsa2048/F461FA2D923C3798 2018-09-18 [SC] BA4CF1650621335540E42DB5F461FA2D923C3798 uid [ultimate] yourname (demo) <yourname@email.com> ssb rsa2048/96E3D9B0C023B825 2018-09-18 [E] 記住sec中算法後面的值,輸入在下面 (說明:也能夠用郵箱地址替換這個KEY值) $ gpg --armor --export F461FA2D923C3798 4. 添加一個user id到GPG key $ gpg --edit-key F461FA2D923C3798 > adduid > quit Save changes? (y/N) y 可使用help瞭解更多命令。 5. 給Git配置提交和tag簽名 $ git config --global user.signingkey F461FA2D923C3798 $ git config --global commit.gpgsign true 提交會自動簽名。 tag簽名須要加入-s,如: $ git tag -s mytag 驗證 $ git tag -v mytag 6. 使用gpg-agent幫助減小密碼輸入,可將下面命令寫入~/.xsession、 ~/.profile或者.bash_profile等啓動文件 eval $(gpg-agent --daemon) 7. 導出導入key 導出 gpg --export-secret-key F461FA2D923C3798 > ~/private.key gpg --export F461FA2D923C3798 > ~/public.key 導入 gpg --import ~/private.key 8. 刪除key gpg --delete-secret-key F461FA2D923C3798 gpg --delete-key F461FA2D923C3798 別名配置: # vim ~/.bash_profile alias -- -='cd -' alias ~='cd ~' alias ..='cd ..' alias ...='cd ../..' alias ....='cd ../../..' alias .....='cd ../../../..' alias ......='cd ../../../../..' alias d='dirs -v | head -10' alias g=git alias ga='git add' alias gaa='git add --all' alias gap='git apply' alias gapa='git add --patch' alias gau='git add --update' alias gb='git branch' alias gba='git branch -a' alias gbd='git branch -d' alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d' alias gbl='git blame -b -w' alias gbnm='git branch --no-merged' alias gbr='git branch --remote' alias gbs='git bisect' alias gbsb='git bisect bad' alias gbsg='git bisect good' alias gbsr='git bisect reset' alias gbss='git bisect start' alias gc='git commit -v' alias 'gc!'='git commit -v --amend' alias gca='git commit -v -a' alias 'gca!'='git commit -v -a --amend' alias gcam='git commit -a -m' alias 'gcan!'='git commit -v -a --no-edit --amend' alias 'gcans!'='git commit -v -a -s --no-edit --amend' alias gcb='git checkout -b' alias gcd='git checkout develop' alias gcf='git config --list' alias gcl='git clone --recursive' alias gclean='git clean -fd' alias gcm='git checkout master' alias gcmsg='git commit -m' alias 'gcn!'='git commit -v --no-edit --amend' alias gco='git checkout' alias gcount='git shortlog -sn' alias gcp='git cherry-pick' alias gcpa='git cherry-pick --abort' alias gcpc='git cherry-pick --continue' alias gcs='git commit -S' alias gcsm='git commit -s -m' alias gd='git diff' alias gdca='git diff --cached' alias gdct='git describe --tags `git rev-list --tags --max-count=1`' alias gdcw='git diff --cached --word-diff' alias gdt='git diff-tree --no-commit-id --name-only -r' alias gdw='git diff --word-diff' alias gf='git fetch' alias gfa='git fetch --all --prune' alias gfo='git fetch origin' alias gg='git gui citool' alias gga='git gui citool --amend' alias ggpur=ggu alias ghh='git help' alias gignore='git update-index --assume-unchanged' alias gignored='git ls-files -v | grep "^[[:lower:]]"' alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' alias gk='\gitk --all --branches' alias gke='\gitk --all $(git log -g --pretty=%h)' alias gl='git pull' alias glg='git log --stat' alias glgg='git log --graph' alias glgga='git log --graph --decorate --all' alias glgm='git log --graph --max-count=10' alias glgp='git log --stat -p' alias glo='git log --oneline --decorate' alias glog='git log --oneline --decorate --graph' alias gloga='git log --oneline --decorate --graph --all' alias glol='git log --graph --pretty='\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit' alias glola='git log --graph --pretty='\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit --all' alias glp=_git_log_prettily alias glum='git pull upstream master' alias gm='git merge' alias gma='git merge --abort' alias gmom='git merge origin/master' alias gmt='git mergetool --no-prompt' alias gmtvim='git mergetool --no-prompt --tool=vimdiff' alias gmum='git merge upstream/master' alias gp='git push' alias gpd='git push --dry-run' alias gpoat='git push origin --all && git push origin --tags' alias gpristine='git reset --hard && git clean -dfx' alias gpu='git push upstream' alias gpv='git push -v' alias gr='git remote' alias gra='git remote add' alias grb='git rebase' alias grba='git rebase --abort' alias grbc='git rebase --continue' alias grbi='git rebase -i' alias grbm='git rebase master' alias grbs='git rebase --skip' alias grep='grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn}' alias grh='git reset HEAD' alias grhh='git reset HEAD --hard' alias grmv='git remote rename' alias grrm='git remote remove' alias grset='git remote set-url' alias grt='cd $(git rev-parse --show-toplevel || echo ".")' alias gru='git reset --' alias grup='git remote update' alias grv='git remote -v' alias gsb='git status -sb' alias gsd='git svn dcommit' alias gsi='git submodule init' alias gsps='git show --pretty=short --show-signature' alias gsr='git svn rebase' alias gss='git status -s' alias gst='git status' alias gsta='git stash save' alias gstaa='git stash apply' alias gstc='git stash clear' alias gstd='git stash drop' alias gstl='git stash list' alias gstp='git stash pop' alias gsts='git stash show --text' alias gsu='git submodule update' alias gts='git tag -s' alias gtv='git tag | sort -V' alias gunignore='git update-index --no-assume-unchanged' alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' alias gup='git pull --rebase' alias gupv='git pull --rebase -v' alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip-- [skip ci]"' alias h=history alias history='fc -l' alias l='ls -lah' alias la='ls -lAh' alias ll='ls -lh' alias ls='ls --color=tty' alias lsa='ls -lah' alias md='mkdir -p' alias po=popd alias pu=pushd alias rd=rmdir alias gitk='start gitk' function open { start "" "`cygpath -w \"$WINDIR/explorer.exe\"`" `cygpath -w $*` } function notepad { fn=${1%:} ln=${fn##*:} fn=${fn%:*} if [[ $var =~ ^-?[0-9]+$ ]]; then start "" notepad $* else start "" notepad -g $ln $fn fi } $ source ~/.bash_profile tarball編譯 https://www.kernel.org/pub/software/scm/git/ **********centos命令以下: $ sudo su # yum install gcc gcc-c++ perl-ExtUtils-MakeMaker -y # yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel -y 下載git源碼(curl和wget選一個便可) # wget -P /usr/src/git-2.19.1 https://www.kernel.org/pub/software/scm/git/git-2.19.1.tar.xz // # wget -P /usr/src/git-2.19.1 https://www.kernel.org/pub/software/scm/git/git-2.19.1.tar.gz // # curl --create-dirs -o /usr/src/git-2.19.1/git-2.19.1.tar.gz https://www.kernel.org/pub/software/scm/git/git-2.19.1.tar.gz # chmod -R 755 /usr/src/git-2.19.1/ 解壓安裝 # cd /usr/src/git-2.19.1/ # tar Jxf git-2.19.1.tar.xz // # tar zxf git-2.19.1.tar.gz # cd git-2.19.1 # ./configure --prefix=/usr/local/ # make install 查看結果,刪除yum的git和git-2.19.1.tar.gz # whereis git git: /usr/bin/git /usr/local/bin/git /usr/share/man/man1/git.1.gz # /usr/local/bin/git --version git version 2.19.1 # rm -f /usr/src/git-2.19.1/git-2.19.1.tar.gz # yum remove git # yum autoremove -y # exit $ git version git version 2.19.1 **********debian命令以下: $ sudo apt update $ sudo apt install -y build-essential $ sudo apt install -y libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev $ sudo curl --create-dirs -o /usr/src/git-2.19.1/git-2.19.1.tar.gz https://www.kernel.org/pub/software/scm/git/git-2.19.1.tar.gz (或) $ sudo wget -P /usr/src/git-2.19.1 https://www.kernel.org/pub/software/scm/git/git-2.19.1.tar.gz $ cd /usr/src/git-2.19.1/ $ sudo tar Jxf git-2.19.1.tar.xz // $ sudo tar zxf git-2.19.1.tar.gz $ cd git-2.19.1 $ sudo ./configure --prefix=/usr/local/ $ sudo make install $ whereis git git: /usr/bin/git /usr/local/bin/git /usr/share/man/man1/git.1.gz $ /usr/local/bin/git version git version 2.15.1 $ sudo rm -f /usr/src/git-2.19.1/git-2.19.1.tar.gz $ sudo apt remove git $ sudo apt autoremove -------------------------- git lfs -------------------------- MacOS $ brew install git-lfs Linux $ mkdir git-lfs $ cd git-lfs $ wget https://github.com/git-lfs/git-lfs/releases/download/v2.5.1/git-lfs-linux-amd64-v2.5.1.tar.gz $ tar xvzf git-lfs-linux-amd64-v2.5.1.tar.gz $ sudo ./install.sh $ git lfs version $ cd .. $ rm -rf git-lfs -------------------------- git flow -------------------------- https://github.com/nvie/gitflow https://github.com/nvie/gitflow/wiki/Linux 安裝方式一: MacOS $ brew install git-flow 或者 $ wget --no-check-certificate -q -O - https://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | sudo bash Debian $ apt-get install git-flow Fedora $ yum install gitflow 安裝方式二:手動安裝 手動安裝方法1(推薦) $ git clone --recursive git://github.com/nvie/gitflow.git $ cd gitflow $ sudo make install 若是安裝到其餘目錄,能夠 $ sudo make prefix=/opt/local install $ git flow version $ cd .. $ rm -rf gitflow 手動安裝方法2 $ wget -q -O - https://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | sh 刪除 $ sudo ./gitflow-installer.sh uninstall 版本:git flow version zsh插件:git-flow、bobthecow/git-flow-completion 若是提示zsh compinit: insecure directories, run compaudit for list. 能夠用下面命令更改權限 compaudit | xargs chmod -R 755 使用:分支feature/demo1,修改後合併到develop分支 $ git clone ... $ cd ... $ git flow init -d $ git flow feature start demo1 // 修改代碼 $ git flow feature finish demo1 分支模式學習文檔: http://nvie.com/posts/a-successful-git-branching-model/ git-extras https://github.com/tj/git-extras $ brew install git-extras $ sudo yum install git-extras $ sudo apt-get install git-extras windows git clone https://github.com/tj/git-extras.git git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) install.cmd 使用方法 https://www.oschina.net/p/git-extras 查看某個貢獻者 git contrib m2nlight 查看repo的概況 git summary 顯示每一個文件的提交數量和活躍時間 git effort --above 15 {src,lib}/* 從某個日期開始的提交 git commits-since yesterday git commits-since last week 顯示提交總數,加上參數--all顯示每位做者的提交數量 git count git count --all 移除最近提交 git undo git undo 3 等等 **Windows** 豐富git-bash工具(須要在PowerShell 3+.NET Framework 4.5+下安裝scoop) 1. 打開PowerShell,安裝scoop(https://scoop.sh/) iex (new-object net.webclient).downloadstring('https://get.scoop.sh') set-executionpolicy unrestricted -s cu 2. 安裝curl, wget, bat... scoop install curl wget bat 3. 其餘scoop命令 scoop help 顯示幫助 scoop list 顯示已安裝的命令 scoop search <keyword> 查找命令 scoop info <name> 信息 scoop uninstall <name> 卸載 scoop update */<name> 更新所有,去掉*只更新scoop 4. 配置git-bash別名 回到git-bash 用cat代替bat echo "alias cat='bat'" >> ~/.bash_profile 添加conflicts顯示衝突文件 git config --global alias.conflicts "diff --name-only --diff-filter=U" git conflicts 5. 安裝diff-so-fancy mkdir -p ~/bin curl https://raw.githubusercontent.com/so-fancy/diff-so-fancy/master/third_party/build_fatpack/diff-so-fancy -L > ~/bin/diff-so-fancy chmod +x ~/bin/diff-so-fancy diff-so-fancy 配置git git config --global core.pager "diff-so-fancy | less --tabs=1,5 -RFX" ---- Install GnuPG ---- https://www.gnupg.org/download/ mac 方式一:推薦 mac $ brew install gpg pinentry pinentry-mac $ echo "pinentry-program /usr/local/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf $ killall gpg-agent 若是使用期間發生錯誤,參考後面的 Inappropriate ioctl for device 配置環境變量。 SourceTree支持: $ ls -la /usr/local/bin/gpg lrwxr-xr-x /usr/local/bin/gpg -> ../Cellar/gnupg/2.2.10/bin/gpg $ ln -s /usr/local/bin/gpg /usr/local/bin/gpg2 在SourceTree的配置界面,點「高級」,更改「GPG程序」路徑爲 /usr/local/bin。 方式二: https://gpgtools.org/ 下載dmg安裝 linux (tarball) $ mkdir ~/gnupg $ cd ~/gnupg $ wget https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-2.2.10.tar.bz2 wget https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.32.tar.bz2 wget https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.3.tar.bz2 wget https://www.gnupg.org/ftp/gcrypt/libksba/libksba-1.3.5.tar.bz2 wget https://www.gnupg.org/ftp/gcrypt/libassuan/libassuan-2.5.1.tar.bz2 wget https://www.gnupg.org/ftp/gcrypt/ntbtls/ntbtls-0.1.2.tar.bz2 wget https://www.gnupg.org/ftp/gcrypt/npth/npth-1.6.tar.bz2 wget https://www.gnupg.org/ftp/gcrypt/pinentry/pinentry-1.1.0.tar.bz2 // wget https://www.gnupg.org/ftp/gcrypt/gpgme/gpgme-1.11.1.tar.bz2 // wget https://www.gnupg.org/ftp/gcrypt/gpa/gpa-0.9.10.tar.bz2 $ tar xvjf gnupg-2.2.10.tar.bz2 tar xvjf libgpg-error-1.32.tar.bz2 tar xvjf libgcrypt-1.8.3.tar.bz2 tar xvjf libksba-1.3.5.tar.bz2 tar xvjf libassuan-2.5.1.tar.bz2 tar xvjf ntbtls-0.1.2.tar.bz2 tar xvjf npth-1.6.tar.bz2 tar xvjf pinentry-1.1.0.tar.bz2 // tar xvjf gpgme-1.11.1.tar.bz2 // tar xvjf gpa-0.9.10.tar.bz2 // 編譯安裝GnuPG組件 $ cd libgpg-error-1.32 $ ./configure $ sudo make && sudo make install $ cd ../libgcrypt-1.8.3 $ ./configure $ sudo make && sudo make install $ cd ../libksba-1.3.5 $ ./configure $ sudo make && sudo make install $ cd ../libassuan-2.5.1 $ ./configure $ sudo make && sudo make install $ cd ../ntbtls-0.1.2 $ ./configure $ sudo make && sudo make install $ cd ../npth-1.6 $ ./configure $ sudo make && sudo make install // 編譯安裝GnuPG $ cd ../gnupg-2.2.10 $ ./configure $ sudo make -j8 && sudo make install $ whereis gpg gpg: /usr/bin/gpg /usr/local/bin/gpg /usr/share/man/man1/gpg.1.gz $ /usr/local/bin/gpg --version /usr/local/bin/gpg: error while loading shared libraries: libgcrypt.so.20: cannot open shared object file: No such file or directory 正常會顯示版本信息,若是出現這個錯誤,先得到libgcrypt.so.20文件的位置,而後加入變量LD_LIBRARY_PATH中: $ whereis libgcrypt.so.20 libgcrypt.so: /usr/lib/libgcrypt.so.11 /usr/lib64/libgcrypt.so.11 /usr/local/lib/libgcrypt.so.20 /usr/local/lib/libgcrypt.so $ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH $ /usr/local/bin/gpg --version gpg (GnuPG) 2.2.10 libgcrypt 1.8.3 Copyright (C) 2018 Free Software Foundation, Inc. ... 將環境變量添加到啓動配置,如.bashrc中 $ echo export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH >> ~/.bashrc 同理檢查PATH環境變量,使/usr/local/bin在/usr/bin前,然gpg命令直接運行咱們編譯的版本。 從新進入會話,輸入 gpg --version 應該是剛纔安裝的版本。 必要組件安裝: --- // 用於輸入密碼保護(必須) $ cd ../pinentry-1.1.0 $ ./configure $ sudo make && sudo make install --- 下面兩個可選,可能須要修改庫的路徑,configure才能正確經過。 // GPGME is the standard library to access GnuPG functions from programming languages. $ cd ../gpgme-1.11.1 $ ./configure $ sudo make && sudo make install // GPA is a graphical frontend to GnuPG. $ cd ../gpa-0.9.10 $ ./configure $ sudo make && sudo make install --- 最後可刪除無用的源文件 $ cd ~ $ sudo rm -rf gnupg