2022年11月6日
在电脑上全局设置了公司的邮箱和账号,提交代码到github时切换账号不方便,所以整一个sh脚本,但是在mac上执行这个脚本时会说权限不足。
所以需要脚本和命令来配合使用
切换当前仓库的git账号和邮箱
# 1.先在你要变更的github仓库的根目录下创建一个sh文件
cd 仓库名
touch reset-github.sh
# 2. 编辑器打开这个文件,填入以下内容
# user.name和user.email 后面,请填写实际的用户名和邮箱
git config --local user.name aiyoudiao
git config --local user.name
git config --local user.email newdiao@163.com
git config --local user.email
echo "set local success!!!!!"
# 3. 填入以上内容之后,编辑器保存
# 4. 给这个文件赋予执行的权限
chmod u+x ./reset-github.sh
# 5. 执行这个文件,查看打印结果
./reset-github.sh
** 超简单操作 **
如果觉得以上的操作比较繁琐,可以直接复制以下命令,直接回车即可,记得修改一下user.name 和 user.emal 后面的账号以及邮箱
echo "git config --local user.name aiyoudiao
git config --local user.name
git config --local user.email newdiao@163.com
git config --local user.email
echo \"set local success!!!!!\"
" > reset-github.sh
chmod u+x ./reset-github.sh
./reset-github.sh
上次更新时间: 10年18月2023日 01时57分53秒