標籤 : gitlinux
[TOC]git
本文是git系列博客的第一篇,主要介紹git在windows,linux,Mac OX等不一樣操做系統下的安裝和配置,主要之後二者爲主。github
sudo apt-get intall git
安裝sudo port install git +bash_completion
)git config --global user.email "you@example.com"
配置郵件git config --global user.name "Your Name"
配置用戶名git config --global color.ui true
開啓顏色顯示~
),看看有沒有.ssh
目錄,若是有,再看看這個目錄下有沒有id_rsa
和id_rsa.pub
這兩個文件,若是已經有了,可直接跳到下一步。若是沒有,打開Shell(Windows下打開Git Bash),建立SSH Key:ssh-keygen -t rsa -C "youremail@example.com"
.ssh
目錄下id_rsa.pub
文件的內容,點「Add Key」# git language export LANGUAGE='en_US.UTF-8 git'
# Git branch in prompt. parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } export PS1="\u@\h:\w\[\033[32m\]\$(parse_git_branch)\[\033[00m\]$ "
參考Add Git Branch Name to Terminal Prompt (Mac)shell
若是是linux或者windows用戶,通常不會出現這個問題,mac下我當時是bash環境沒設置好,按照這篇文章安的,使用的是Command Line Tools安裝的git,不能識別macports裏的git的補全。有幾種辦法能夠徹底補全ubuntu
參考git auto-complete for branches at the command line?windows
1.經過curl下載:curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
bash
2.在~/.bash_profile
裏添加app
if [ -f ~/.git-completion.bash ]; then . ~/.git-completion.bash fi
參考:How to use bash-completionssh
檢查的下本身的bash:which bash
,which -a bash
curl
檢查下支持的shell:cat /etc/shells
查看當前shell:echo $SHELL