1 Star 0 Fork 5

lize/dugitools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
014.setup_git.sh 2.54 KB
一键复制 编辑 原始数据 按行查看 历史
大吉客 提交于 2023-09-07 00:25 . 1.修改,修改014增加cygwin支持
#!/bin/bash
#作者:DUGIGEEK
#日期:2018.12.08
#描述:git的配置
#-------------------------------------------------
function pok(){ (echo -e "\033[47;42m$*\033[0m";) }
function sok(){ (echo -e "\033[32;01m$*\033[0m";) }
function perr(){ (echo -e "\033[47;41m$*\033[0m";) }
function serr(){ (echo -e "\033[31;01m$*\033[0m";) }
function pdone(){ (echo -e "\033[47;42m$*\033[0m";) }
function perro(){ (echo -e "\033[47;41m$*\033[0m";) }
function pwarn(){ (echo -e "\033[30;43m$*\033[0m";) }
function pnote(){ (echo -e "\033[47;45m$*\033[0m";) }
function pshow(){ (echo -e "\033[47;46m$*\033[0m";) }
function pshow(){ (echo -e "\033[47;46m$*\033[0m";) }
function pinfo(){ (echo -e "\033[30;44m$*\033[0m";) }
function pecho(){ (echo -e "\033[30;47m$*\033[0m";) }
function sdone(){ (echo -e "\033[32;01m$*\033[0m";) }
function sinfo(){ (echo -e "\033[34;01m$*\033[0m";) }
function swarn(){ (echo -e "\033[33;01m$*\033[0m";) }
function serro(){ (echo -e "\033[31;01m$*\033[0m";) }
function snote(){ (echo -e "\033[35;01m$*\033[0m";) }
function sshow(){ (echo -e "\033[36;01m$*\033[0m";) }
#-------------------------------------------------
#设置当前用户的git名称和邮箱
user_name=$(whoami)
user_mail=2362317758@qq.com
iscygwin=$(uname -a | grep -i cygwin)
if [ -n "${iscygwin}" ]; then
export MSUDO=""
export MAPT=echo
else
export MSUDO=sudo
export MAPT=apt-get
fi
mainproc()
{
if [ -z "${iscygwin}" ]; then
$MSODO $MAPT install git -y
if [ $? -ne 0 ]; then
serro "Install git [ERROR]"
exit 1
fi
sdone "Install git [OK]"
fi
#写入用户信息
git config --global user.name "${user_name}"
#sdone "\ngit config --global user.name \"${user_name}\" [OK]"
git config --global user.email "${user_mail}"
#sdone "git config --global user.email \"${user_mail}\" [OK]"
#不自动识别转义字符(防止git status中文乱码)
git config --global core.quotepath false
#sdone "git config --global core.quotepath false [OK]"
#不自动替换crlf格式(防止shell无法执行)
git config --global core.autocrlf false
#sdone "git config --global core.autocrlf false [OK]"
#防止GnuTLS错误
isnotify=$(cat ~/.bashrc|grep GIT_SSL_NO_VERIFY)
if [ -z "$isnotify" ]; then
echo 'export GIT_SSL_NO_VERIFY=1' >> ~/.bashrc
git config --global --unset http.proxy
git config --global --unset git.proxy
if [ -z "${iscygwin}" ]; then
$MSUDO $MAPT install -y gnutls-bin
fi
git config --global http.sslVerify false
git config --global http.postBuffer 1048576000
fi
#避免中文乱码
git config --global core.quotepath false
sdone OK
}
mainproc $@
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/lize/dugitools.git
git@gitee.com:lize/dugitools.git
lize
dugitools
dugitools
master

搜索帮助