安装git以及clone repo

Categories: Uncategorized
Tags: No Tags
Comments: No Comments
Published on: 2017/01/28

继续流水账记录一下安装过程。
先装git
$ sudo apt-get update
$ sudo apt-get install git

稍微配置一下
$ git config --global user.name "Your Name"
$ git config --global user.email "youremail@domain.com"

配置ssh key
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
按提示输入信息,然后
$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/id_rsa

最后把public key(默认是~/.ssh/id_rsa.pub)存到git server就可以了。

装个git prompt这样命令行前缀能显示更多的信息:

$ cd ~
$ git clone https://github.com/magicmonty/bash-git-prompt.git .bash-git-prompt --depth=1
$ cat <> ~/.bashrc
   # Set config variables first
   GIT_PROMPT_ONLY_IN_REPO=1

   # GIT_PROMPT_FETCH_REMOTE_STATUS=0   # uncomment to avoid fetching remote status

   # GIT_PROMPT_SHOW_UPSTREAM=1 # uncomment to show upstream tracking branch
   # GIT_PROMPT_SHOW_UNTRACKED_FILES=all # can be no, normal or all; determines counting of untracked files

   # GIT_PROMPT_SHOW_CHANGED_FILES_COUNT=0 # uncomment to avoid printing the number of changed files

   # GIT_PROMPT_STATUS_COMMAND=gitstatus_pre-1.7.10.sh # uncomment to support Git older than 1.7.10

   # GIT_PROMPT_START=...    # uncomment for custom prompt start sequence
   # GIT_PROMPT_END=...      # uncomment for custom prompt end sequence

   # as last entry source the gitprompt script
   # GIT_PROMPT_THEME=Custom # use custom theme specified in file GIT_PROMPT_THEME_FILE (default ~/.git-prompt-colors.sh)
   # GIT_PROMPT_THEME_FILE=~/.git-prompt-colors.sh
   # GIT_PROMPT_THEME=Solarized # use theme optimized for solarized color scheme
   source ~/.bash-git-prompt/gitprompt.sh
EOF
No Comments - Leave a comment

Leave a comment

Your email address will not be published. Required fields are marked *


Close Print