叶千辰  

Git环境配置

1、下载与安装

下载地址:https://git-scm.com/download

教程:https://blog.csdn.net/weixin_44024740/article/details/121633199

 

2、设置和查看用户名、邮箱

设置:

git config --global user.name "用户名"
git config --global user.email "邮箱地址"

查看:

git config --global user.name
git config --global user.email

 

3、为常用指令配置别名

有些常用指令的参数非常多,为了简便,我们为其配置别名。

步骤:

(1)打开用户目录,打开gitbash,输入如下命令:

touch ~/.bashrc

(2)在.bashrc,输入如下内容

#用于输出git提交日志 
alias git-log='git log --pretty=oneline --all --graph --abbrev-commit'
#用于输出当前目录所有文件及基本信息
alias ll='ls -al'

(3)执行以下命令:

source ~/.bashrc

 

4、解决GitBash乱码问题

(1)执行以下命令:

git config --global core.quotepath false

(2) 在${git_home}/etc/bash.bashrc 文件的最后,加入下面两行:

export LANG="zh_CN.UTF-8" 
export LC_ALL="zh_CN.UTF-8"

 

 

 

 

 

 

 

 

 



posted on 2022-04-27 21:54  叶千辰  阅读(127)  评论(0)    收藏  举报