在 Git 中设置用户名,避免每次git都要输入用户名和密码

在 Git 中设置用户名可以通过以下命令完成:

 
git config --global user.name "Your Username"
git config --global user.email "your_email@example.com"

## 添加缓存时间
git config --global credential.helper 'cache --timeout=999999999'
git config --global credential.helper

 

将上述命令中的 "Your Name" 替换为你想要设置的用户名。这会将用户名配置为全局属性,适用于你所使用的所有 Git 仓库。

然后重新git 一下工程,输入一次 用户名密码之后,以后就不必再次输入了。

 

如果你是虚拟机里面的centos7系统

你有 xshell工具,建议在xshell里面设置,

然后在虚拟机里面也再次设置一次。

 

posted @ 2024-03-23 14:31  He_LiangLiang  阅读(14)  评论(0编辑  收藏  举报