我试图创建一个TeamCity构建配置来检查git repo,对repo中的文本文件进行一些小改动,然后将更改推回到repo。我有一段时间让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.
我尝试在工作目录中编写密钥并让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 --version
是2.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'
答案 0 :(得分:0)
关于https,您需要:
确保网址为
https://<username>@github.com/<username>/arepo
有一个凭据管理器来缓存密码
git config -l credential.helper
请参阅“Git Tools - Credential Storage”和this setting。
然后尝试手动git ls-remote https://...
以触发提示,询问您的密码,该密码将被缓存。
然后,TeamCity将能够重用这些缓存的凭据。