我有应用程序服务器,我使用Chef +一些特别的bash脚本引导在一起。问题是,当我想在这些应用服务器上运行更新时,我得到:

19:00:28: *** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

我真的需要在每次更新应用服务器时设置简单的git pull origin master吗?是否有任何方法来覆盖这种行为,以便在没有设置姓名和电子邮件时不会出错?


当前回答

无法自动检测电子邮件地址。

默认情况下,它采用您的系统用户名,如abc@xyz.none。

所以你需要像下面这样设置你的邮箱:

git config user.email "someone@gmail.com"

设置email后,你可以运行git命令并提交你的更改。

git init Git add * Git commit -m "some init msg"

其他回答

如果您正在使用sourcetree: Repository -> Repository Settings -> Advanced ->取消勾选“使用全局用户设置”框

对我来说很管用。

当我调用PHP脚本初始化并提交到git时,我花了很多时间在它上面。 我发现工作流程应该是这样的:

git init Git配置user.name“某人” Git配置用户。电子邮件“someone@someplace.com” Git add * Git commit -m "some init msg"

如果您交换[23]和1,配置将无法工作。

我希望这能有所帮助。

我犯了个错误 我在本地设置了响应。对于回购

git config --local user.email "AppServer@your_domain.something"
#git config --local ...
git stash
#optionally unset to minimize risk of fake user commits ...
#esp if someone other than you uses the repo too
git config --local --unset user.email
#git config --local --unset ...

我没有git拉的错误,所以我不能测试这是否会有帮助,然后

另请参阅

git配置的优先级是什么?

我的Git配置中的设置是从哪里来的?

而不是做一个git拉,你可以做:

git fetch
git reset --hard origin/master

这两种方法都不需要配置git用户名/电子邮件。

这将破坏任何未提交的本地更改/提交,并将使HEAD指向一个提交(而不是一个分支)。但对于应用服务器来说,这两个都不是问题,因为您不应该进行本地更改或提交到该存储库。

我真的需要在每次更新应用服务器时设置简单的git pull origin master吗?是否有任何方法来覆盖这种行为,以便在没有设置姓名和电子邮件时不会出错?

它只会问一次,并确保这台机器的rsa公钥已添加到您试图提交或传递拉请求的github帐户上。

更多信息可以在这里找到