【发布时间】:2015-07-10 14:53:16
【问题描述】:
首先我要提到的是我不能使用 ssh。
除此之外,如果有人能提供帮助,我将永远感激不尽。
我需要在我的机器人上运行一个构建后脚本,该脚本创建一个标签并在构建成功时将其推送到远程。我尝试将它作为在机器人上定义的“发布”脚本、作为项目构建设置中的“构建阶段”以及作为我用于 CI 的自定义共享方案中的构建后脚本运行。脚本如下所示:
if [ -z "$PROJECT_DIR" ]; then
echo "No project dir variable"
else
cd $PROJECT_DIR;
echo "PROJECT_DIR is $PROJECT_DIR";
echo "Directory is $(pwd)";
git config user.email "myself@mycompany.com"
git config user.name "myself"
CURRENTTAG=$(git describe --abbrev=0 --tags);
echo "CURRENTTAG is $CURRENTTAG";
CURRENTTAG_PRE=`echo $CURRENTTAG | awk -F "_" '{print $1}'`;
echo "CURRENTTAG_PRE is $CURRENTTAG_PRE";
CURRENTTAG_POST=`echo $CURRENTTAG | awk -F "_" '{print $2}'`;
echo "CURRENTTAG_POST is $CURRENTTAG_POST";
if [ -z "$CURRENTTAG_POST" ]; then
echo "catastrophic failure"
exit 0
else
CURRENTTAG_POST=$(($CURRENTTAG_POST + 1));
SPACE="_";
NEW_TAG=$CURRENTTAG_PRE$SPACE$CURRENTTAG_POST;
echo "NEW_TAG is $NEW_TAG";
git tag -a $NEW_TAG -m "$NEW_TAG";
git push origin "$NEW_TAG"
echo "New tag $(git describe --abbrev=0 --tags) created"
fi
fi
所以,git config 命令的 hack 可以阻止 git 询问机器人“请告诉我你是谁”。但是,一旦机器人通过了这个, git push 就会失败,并显示以下内容:
fatal: could not read Password for 'https://myself@mygitremote.com': Device not configured
任何人都可以提供任何基于 HTTPS 的建议,告诉我如何解决这个问题吗?
顺便说一下,我使用的是 Xcode 6.4 和 Server 4.1.2。
谢谢。
编辑:我已经看到了很多解决方案,这些解决方案都是从 sudo 进入 _xcsbuildd 的 shell 开始的。在 Xcode Server 4.1 中肯定没有 _xcsbuildd 的主目录,所以你不能“git config --global”任何东西。
【问题讨论】:
-
您是否在
.netrc文件或其他可以读取 git push 的地方输入了密码? -
问题是运行脚本的 _xcsbuildd 用户实际上并没有 $HOME 或 shell。我试着给它一个外壳,它开始在其他地方破坏其他东西。这使得任何基于用户级设置的解决方案都不可能。
-
注意你不需要运行
git config --global——如果你想拥有每个存储库的凭据。如果您运行git config,那么它只会将更改应用到该存储库。
标签: ios xcode git continuous-integration xcode-server