Linux开发环境显示当前所在分支还是很重要的~
vim ~/.bash_profile
将如下内容拷贝到step1中打开的.bash_profile文件末尾, 然后执行
source ~/.bash_profile
function find_git_branch {
local dir=. head
until [ "$dir" -ef / ]; do
if [ -f "$dir/.git/HEAD" ]; then
head=$(< "$dir/.git/HEAD")
if [[ $head == ref:\ refs/heads/* ]]; then
git_branch=" (*${head#*/*/})"
elif [[ $head != '' ]]; then
git_branch=' (detached)'
else
git_branch=' (unknown)'
fi
return
fi
dir="../$dir"
done
git_branch=''
}
PROMPT_COMMAND="find_git_branch; $PROMPT_COMMAND"
green=$'\e[1;32m'
magenta=$'\e[1;35m'
normal_colours=$'\e[m'
PS1="\[$green\]\u@\h:\w\[$magenta\]\$git_branch\[$green\]\\$\[$normal_colours\] "
生成id_rsa 文件,复制到gitlab的ssh设置上即可
ssh-keygen -t rsa -C "您的邮箱地址" //然后一路回车即可 cat ~/.ssh/id_rsa.pub