gpt4 book ai didi

Git 从 TeamCity 9.0.3 构建推送

转载 作者:行者123 更新时间:2023-12-02 14:07:20 32 4
gpt4 key购买 nike

我正在尝试创建一个 TeamCity 构建配置,以检查 git 存储库,对存储库中的文本文件进行小的更改,然后将更改推送回存储库。让 git push 命令从 Ubuntu 构建代理工作真是太糟糕了。

ssh认证和https认证我都试过了:

使用 HTTPS 我得到这个错误:

could not read Username for 'https://github.com': No such device or address

所以我尝试了:

git config user.name "<my username>"
git config user.email "<my email>"

同样的错误。

使用 SSH 我得到这个错误:

ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
Host key verification failed.
fatal: Could not read from remote repository.

我尝试在工作目录中写入我的 key 并让 git 像这样使用它:

cat << EOF > github.key
%secure:teamcity.password.chambm ssh key%
EOF
chmod 600 github.key

GIT_SSH_COMMAND='ssh -i github.key' git push origin master
shred github.key

同样的错误。

据我所知,/etc/ssh_config/etc/gitconfig~/.ssh/config 中没有异常设置 不存在。为什么这么难?为什么 git 调用 ssh_askpass 即使我给它一个私钥使用?

git --version2.7.4

环境变量:

export BUILD_NUMBER='44'
export BUILD_VCS_NUMBER='50e0d54d7045fcf0bd6949a06d82ac2f118bc5d9'
export BUILD_VCS_NUMBER_ProteoWizard_HttpsGithubComBiocondaBiocondaRecipes='50e0d54d7045fcf0bd6949a06d82ac2f118bc5d9'
export DISPLAY=':3'
export FIREFOX38='/tcuser/apps/firefox38/firefox'
export FIREFOX45='/tcuser/apps/firefox45/firefox'
export FIREFOX52='/tcuser/apps/firefox52/firefox'
export FIREFOX_HOME='/usr/bin/firefox'
export HOME='/home/tcuser'
export JAVA_HOME='/usr/lib/jvm/default-java'
export JDK_17='/usr/lib/jvm/java-7-sun'
export JDK_18='/usr/lib/jvm/java-8-sun'
export JRE_HOME='/usr/lib/jvm/default-java'
export LANG='en_US.UTF-8'
export LOGNAME='tcuser'
export MAIL='/var/mail/tcuser'
export NUMBER_OF_CORES='4'
export OLDPWD='/tcuser/apps/teamcity/agent/bin'
export PATH='/home/tcuser/bin:/home/tcuser/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin'
export PERL_HOME='/usr/bin'
export PWD='/mnt/teamcity/agent/work/2cc04074d294b6fa'
export PYTHON2='/usr/bin/python'
export PYTHON3='/usr/bin/python3'
export R_HOME='/tcuser/apps/R/default'
export SHELL='/bin/bash'
export SHLVL='1'
export TEAMCITY_AGENT_OPTS='-Duser.timezone=America/Los_Angeles'
export TEAMCITY_BUILDCONF_NAME='Bumbershoot update bioconda'
export TEAMCITY_BUILD_PROPERTIES_FILE='/mnt/teamcity/agent/temp/buildTmp/teamcity.build7482307983791518712.properties'
export TEAMCITY_CAPTURE_ENV='"/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java" -jar "/tcuser/apps/teamcity/agent/plugins/environment-fetcher/bin/env-fetcher.jar"'
export TEAMCITY_GIT_PATH='/usr/bin/git'
export TEAMCITY_PROCESS_FLOW_ID='1039593210152446'
export TEAMCITY_PROCESS_PARENT_FLOW_ID=''
export TEAMCITY_PROJECT_NAME='Bioconda'
export TEAMCITY_VERSION='9.0.3 (build 32334)'
export TEMP='/mnt/teamcity/agent/temp/buildTmp'
export TMP='/mnt/teamcity/agent/temp/buildTmp'
export TMPDIR='/mnt/teamcity/agent/temp/buildTmp'
export TZ='PST8PDT'
export USER='tcuser'
export XDG_RUNTIME_DIR='/run/user/1002'
export XDG_SESSION_ID='c8'

最佳答案

关于https,你需要:

  • 确保 URL 是

    https://<username>@github.com/<username>/arepo
  • 有一个凭证管理器来缓存密码

    git config -l credential.helper

参见“Git Tools - Credential Storage”和this setting .

然后手动尝试 git ls-remote https://... 以触发询问密码的提示,密码将被缓存。
然后 TeamCity 将能够重用这些缓存的凭据。

关于Git 从 TeamCity 9.0.3 构建推送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47398545/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com