如何从LocalSystem帐户下运行的rake正确设置git commit --author? [英] How to set git commit --author properly from rake running under LocalSystem account?

查看:225
本文介绍了如何从LocalSystem帐户下运行的rake正确设置git commit --author?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在TeamCity @ windows下运行我的CI过程的Rake构建脚本。
脚本所做的一个步骤是对远程存储库进行一些更改(这个存储库代表我的共享主机上的真实生产环境,它仅具有ftp访问权限,因此我将该位置映射为Windows驱动器) p>

部分ruby如下所示:

  shgit commit -v -m#{version_tag}

但是,当脚本由teamcity build agent运行时LocalSystem帐户),我收到以下警告:

  [master e7a5a8d] v0.4.7.0 
提交者:未知< SYSTEM @(无)>
您的姓名和电子邮件地址是基于您的用户名和主机名
自动配置的。请检查它们是否准确。
您可以通过显式设置它来禁止此消息:
git config --global user.nameYour Name
git config --global user.email you@example.com
如果用于此提交的身份不正确,可以使用以下命令修复它:
git commit --amend --author ='您的姓名< you@example.com>'
9个文件已更改, 0插入(+),0删除( - )

读取写入的内容我将rake脚本命令更改为:

  shgit commit --author ='TeamCity< no@email.com>'-v -m#{ version_tag}

但是这个命令导致了一个奇怪的失败(以前提交成功,但带有警告) 。这是我从TeamCity构建日志中得到的唯一结果:

  git commit --author ='TeamCity< no @ email.com>'-v -m v1.0.18.10 
[19:06:20]:[Execute _3_deployment_stage:to_ftp]系统找不到指定的文件。

如何成功设置作者以提交在LocalSystem帐户下运行的脚本?

解决方案

我发现了一个不同的解决方案来解决我的问题。我将TeamCity代理配置为在自定义Windows帐户下运行。我需要登录到这个帐户,并设置两个:

  git config --global user.email some@email.com 
git config --global user.name TeamCity

通过此设置,命令:

  shgit commit --author ='TeamCity< some@email.com>'-v -m#{version_tag }

仍然会产生怪异现象:系统找不到指定的文件。错误。但是,在全局设置帐户设置后,我可以从commit语句中删除--author选项,并将其保留为:

  sh git commit -v -m#{version_tag}

并且产生期望的效果。 p>

I have Rake build script for my CI process running under TeamCity@windows. One of the steps that the script does is to commit some changes to remote repository (this repository represents real production environment on my shared hosting. It has only ftp access, so I map this location as a windows drive)

Part of ruby looks like this:

  sh "git commit -v -m #{version_tag}"

However, when script is run by teamcity build agent (which runs under LocalSystem account), I get the following warning:

[master e7a5a8d] v0.4.7.0
Committer: unknown <SYSTEM@.(none)>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
If the identity used for this commit is wrong, you can fix it with:
git commit --amend --author='Your Name <you@example.com>'
9 files changed, 0 insertions(+), 0 deletions(-)

Reading what's written I altered my rake script command to:

  sh "git commit --author='TeamCity <no@email.com>' -v -m #{version_tag}"

but this command results with a weird failure (previously commit was successful, but with warning). This is the only thing I get as an output from TeamCity build log:

git commit --author='TeamCity <no@email.com>' -v -m v1.0.18.10
[19:06:20]: [Execute _3_deployment_stage:to_ftp] The system cannot find the file specified.

How can I successfully set up an author for a commit for script running under LocalSystem account ?

解决方案

I found a different solution to my problem. I configured TeamCity agent to run under custom windows account. I needed to log in to this account, and set both:

git config --global user.email some@email.com
git config --global user.name TeamCity

With this set up, the command:

sh "git commit --author='TeamCity <some@email.com>' -v -m #{version_tag}"

still generates the weird: "The system cannot find the file specified." error. However, having account settings set up globally I could remove the --author option from the commit statement, leaving it with:

sh "git commit -v -m #{version_tag}"

and that produces the desired effect.

这篇关于如何从LocalSystem帐户下运行的rake正确设置git commit --author?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆