Linux-git安装

基本操作

  1. 安装yum install git
  2. 生成SSH KEY :先cd ~/.ssh,在这个目录下输入ssh-keygen,一直回车就可以了,这个时候就会出现id_rsd.pub公钥和id_rsa私钥,然后cat id_rsa.pub,把这个公钥复制到对应的码云平台或者是github上,配置SSH Key
  3. 基本命令
git config git init
git clone git remote
git fetch git commit
git rebase git push
  1. 此时就可以通过git clone github上对应ssh连接,把代码克隆到本地了

学习网址http://www.runoob.com/git/git-tutorial.html

命令自动补全

  1. 下载源码 使用下载源码中的 git-completion.bash 自动补全命令的文件 git clone [email protected]:git/git.git ,前提是你在github上配置了公钥
  2. 复制git-completion.bash 文件cp contrib/completion/git-completion.bash /etc/bash_completion.d/
  3. 加载bash脚本source /etc/bash_completion.d/git-completion.bash
  4. 自动加载脚本,编辑vim ~/.bash_profile,添加下面的就可以了
# Git bash autoload
if [ -f /etc/bash_completion.d/git-completion.bash ]; then
source /etc/bash_completion.d/git-completion.bash
fi

猜你喜欢

转载自www.cnblogs.com/mengd/p/9449827.html
今日推荐