安装Git

1
2
3
4
5
6
ganxy03@raspberrypi:~ $ sudo apt-get install git
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成
git 已经是最新版 (1:2.30.2-1+deb11u2)。

检查Git版本

1
2
3
ganxy03@raspberrypi:~ $ git --version
git version 2.30.2

接下来进行Git的全局设置

1
2
3
ganxy03@raspberrypi:~ $ git config --global user.name "ganxy03"
ganxy03@raspberrypi:~ $ git config --global user.email "[email protected]"

然后查看全局设置

1
2
ganxy03@raspberrypi:~ $ ls -la

全局设置保存在.gitconfig中,查看全局设置cat .gitconfig。

1
2
3
4
ganxy03@raspberrypi:~ $ cat .gitconfig
[user]
name = ganxy03
email = [email protected]

那么就配置对了
参考 https://zhuanlan.zhihu.com/p/112112207