如何使用 "Your account is suspended" 解决 Git 获取状态码 128
How to solve Git fetch status code 128 with "Your account is suspended"
我有一个 Jenkins master,它有两个构建代理,其中一个是 Windows 盒子,另一个是 Mac。以下 Jenkinsfile 尝试从 Github Enterprise 服务器检出 git 存储库。
properties([
parameters([
string(
name: 'GIT_URL',
defaultValue: params.GIT_URL?:'https://github.com/',
description: 'URL to clone the Git repo.'
),
string(
name: params.GIT_SELECTOR?:'GIT_SELECTOR',
defaultValue: params.GIT_SELECTOR?:'refs/heads/master',
description: 'Branch, tag or commit.'
),
[
$class: 'CredentialsParameterDefinition',
name: 'GIT_CREDENTIALS',
credentialType: 'com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl',
defaultValue: params.GIT_CREDENTIALS?:'',
description: 'User and password to clone the Git repository',
required: true
]
])
])
node('build'){
stage('Clean'){
cleanDir()
sh('''
pwd
ls -la
''')
}
stage('Identify host'){
def host = command("hostname")
def hostOS = isUnix()?'mac':'win'
currentBuild.description = " ${hostOS}-host"
}
stage('Check out'){
checkout([
$class: 'GitSCM',
branches: [
[name: params.GIT_SELECTOR]
],
extensions: [
[
$class: 'RelativeTargetDirectory',
relativeTargetDir: 'app'
]
],
userRemoteConfigs: [
[
credentialsId: params.GIT_CREDENTIALS,
url: GIT_URL
]
]
])
}
}
当构建进入 Windows 框时它成功了,但它最近开始在 Mac 上失败,原因不明。我得到的错误是:
Cloning the remote Git repository
Cloning repository https://github.acme.com/Acme/foo-project.git
> git init /Jenkins/workspace/.tests/test-checkout/app # timeout=10
Fetching upstream changes from https://github.acme.com/Acme/foo-project.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials my-git-credentials
> git fetch --tags --progress https://github.acme.com/Acme/foo-project.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --tags --progress https://github.acme.com/Acme/foo-project.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: remote: Your account is suspended. Please check with your installation administrator.
fatal: unable to access 'https://github.acme.com/Acme/foo-project.git/': The requested URL returned error: 403
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1877)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1596)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access0(CliGitAPIImpl.java:71)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:348)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:545)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.call(RemoteGitImpl.java:153)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.call(RemoteGitImpl.java:146)
at hudson.remoting.UserRequest.perform(UserRequest.java:153)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request.run(Request.java:332)
at hudson.remoting.InterceptingExecutorService.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at hudson.remoting.Engine.run(Engine.java:85)
at java.lang.Thread.run(Thread.java:745)
at ......remote call to Channel to /208.83.1.25(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1545)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
at hudson.remoting.Channel.call(Channel.java:830)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
at sun.reflect.GeneratedMethodAccessor1126.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
at com.sun.proxy.$Proxy75.execute(Unknown Source)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1067)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1107)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:260)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution.run(AbstractSynchronousNonBlockingStepExecution.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
请注意消息 status code 128
和 The requested URL returned error: 403
中关于 GitException
和 git fetch
错误的位。当然,因为它确实适用于 Windows 框,我知道它绝对不是凭据。这可能是什么原因造成的?我应该看什么?
编辑: 我试过使用 curl -X GET https://github.acme.com/api/v3/user -H 'Authorization: token *****...****'
和 [=32= 从两个奴隶中击中 Github API ] 盒子工作正常,在 Mac 一个我得到的:
{
"message": "Must authenticate to access this API.",
"documentation_url": "https://developer.github.com/enterprise/2.11/v3"
}
您可以尝试以下几种方法:
您的 GitHub 企业实例将包含详细说明失败身份验证的日志。向您的管理员询问这些信息,因为他们可能会立即得到答案。
如果您有权对您的用户执行此操作,请尝试使用基本身份验证(例如 https://github.acme.com/api/v3/user
) - 如果 403 也失败了,你应该在响应 body 和 headers.
中获得一些关于它的原因的信息
经过多次故障排除后,我们发现唯一可以解决此问题的方法是 Mac 构建代理的硬重启。弹回盒子后,发送给它的所有作业都可以再次访问 Git 服务器。
我一直没能找到发生这种情况的原因,所以这是目前为止最好的答案。如果有人对这种行为的潜在原因有任何建议,我倾向于将其标记为答案而不是这个。
我有一个 Jenkins master,它有两个构建代理,其中一个是 Windows 盒子,另一个是 Mac。以下 Jenkinsfile 尝试从 Github Enterprise 服务器检出 git 存储库。
properties([
parameters([
string(
name: 'GIT_URL',
defaultValue: params.GIT_URL?:'https://github.com/',
description: 'URL to clone the Git repo.'
),
string(
name: params.GIT_SELECTOR?:'GIT_SELECTOR',
defaultValue: params.GIT_SELECTOR?:'refs/heads/master',
description: 'Branch, tag or commit.'
),
[
$class: 'CredentialsParameterDefinition',
name: 'GIT_CREDENTIALS',
credentialType: 'com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl',
defaultValue: params.GIT_CREDENTIALS?:'',
description: 'User and password to clone the Git repository',
required: true
]
])
])
node('build'){
stage('Clean'){
cleanDir()
sh('''
pwd
ls -la
''')
}
stage('Identify host'){
def host = command("hostname")
def hostOS = isUnix()?'mac':'win'
currentBuild.description = " ${hostOS}-host"
}
stage('Check out'){
checkout([
$class: 'GitSCM',
branches: [
[name: params.GIT_SELECTOR]
],
extensions: [
[
$class: 'RelativeTargetDirectory',
relativeTargetDir: 'app'
]
],
userRemoteConfigs: [
[
credentialsId: params.GIT_CREDENTIALS,
url: GIT_URL
]
]
])
}
}
当构建进入 Windows 框时它成功了,但它最近开始在 Mac 上失败,原因不明。我得到的错误是:
Cloning the remote Git repository
Cloning repository https://github.acme.com/Acme/foo-project.git
> git init /Jenkins/workspace/.tests/test-checkout/app # timeout=10
Fetching upstream changes from https://github.acme.com/Acme/foo-project.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials my-git-credentials
> git fetch --tags --progress https://github.acme.com/Acme/foo-project.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --tags --progress https://github.acme.com/Acme/foo-project.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: remote: Your account is suspended. Please check with your installation administrator.
fatal: unable to access 'https://github.acme.com/Acme/foo-project.git/': The requested URL returned error: 403
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1877)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1596)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access0(CliGitAPIImpl.java:71)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:348)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:545)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.call(RemoteGitImpl.java:153)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.call(RemoteGitImpl.java:146)
at hudson.remoting.UserRequest.perform(UserRequest.java:153)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request.run(Request.java:332)
at hudson.remoting.InterceptingExecutorService.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at hudson.remoting.Engine.run(Engine.java:85)
at java.lang.Thread.run(Thread.java:745)
at ......remote call to Channel to /208.83.1.25(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1545)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
at hudson.remoting.Channel.call(Channel.java:830)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
at sun.reflect.GeneratedMethodAccessor1126.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
at com.sun.proxy.$Proxy75.execute(Unknown Source)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1067)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1107)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:260)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution.run(AbstractSynchronousNonBlockingStepExecution.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
请注意消息 status code 128
和 The requested URL returned error: 403
中关于 GitException
和 git fetch
错误的位。当然,因为它确实适用于 Windows 框,我知道它绝对不是凭据。这可能是什么原因造成的?我应该看什么?
编辑: 我试过使用 curl -X GET https://github.acme.com/api/v3/user -H 'Authorization: token *****...****'
和 [=32= 从两个奴隶中击中 Github API ] 盒子工作正常,在 Mac 一个我得到的:
{
"message": "Must authenticate to access this API.",
"documentation_url": "https://developer.github.com/enterprise/2.11/v3"
}
您可以尝试以下几种方法:
您的 GitHub 企业实例将包含详细说明失败身份验证的日志。向您的管理员询问这些信息,因为他们可能会立即得到答案。
如果您有权对您的用户执行此操作,请尝试使用基本身份验证(例如
https://github.acme.com/api/v3/user
) - 如果 403 也失败了,你应该在响应 body 和 headers. 中获得一些关于它的原因的信息
经过多次故障排除后,我们发现唯一可以解决此问题的方法是 Mac 构建代理的硬重启。弹回盒子后,发送给它的所有作业都可以再次访问 Git 服务器。
我一直没能找到发生这种情况的原因,所以这是目前为止最好的答案。如果有人对这种行为的潜在原因有任何建议,我倾向于将其标记为答案而不是这个。