我有应用程序服务器,我使用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吗?是否有任何方法来覆盖这种行为,以便在没有设置姓名和电子邮件时不会出错?


当前回答

要设置this/current repo的配置,只需删除——global并设置名称/电子邮件,如下所示:

$ git config user.name "John Doe" 
$ git config user.email "JohnDoe@gmail.com" 

其他回答

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

对我来说很管用。

git config user.email "insert github email here"
git config user.name "insert github real name here"

这对我来说很有效。

恕我冒昧,解决这个错误的正确方法是配置你的全局git配置文件。

执行以下命令:git config——global -e

将出现一个编辑器,您可以在其中插入默认的git配置。

以下是一些例子:

[user]
    name = your_username
    email = your_username@users.noreply.github.com 
[alias]
    # BASIC
    st = status
    ci = commit
    br = branch
    co = checkout
    df = diff

具体操作请参见自定义Git - Git配置

当你看到这样的命令,git config…

$ git config --global core.whitespace \
    trailing-space,space-before-tab,indent-with-non-tab

... 你可以把它放到你的全局git配置文件中:

[core]
   whitespace = space-before-tab,-indent-with-non-tab,trailing-space

对于一次性配置,你可以使用git config——global user.name 'your_username'

如果你没有全局设置你的git配置,你需要为你在本地使用的每一个git repo这样做。

user.name和user.name。email设置告诉git你是谁,所以后续git提交命令不会报错,***请告诉我你是谁。

很多时候,git建议您运行的命令并不是您应该运行的命令。这一次,建议的命令还不错:

$ git commit -m 'first commit'

*** Please tell me who you are.

Run

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

提示:在我非常熟悉git之前,在运行建议的git命令和探索我认为可行的东西之前,对我的项目文件进行备份,在很多情况下挽救了我的生命。

Git pull不需要这个。 然而,如果拉操作导致合并冲突,那么它似乎是必要的。

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

git fetch
git reset --hard origin/master

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

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