标签 : 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