我有一个非常奇怪的问题与git和github。当我试着推的时候,我得到:
git push -u origin master
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
我添加了遥控器:
git remote add origin git@github.com:account-name/repo-name.git
什么好主意吗?
我有一个非常奇怪的问题与git和github。当我试着推的时候,我得到:
git push -u origin master
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
我添加了遥控器:
git remote add origin git@github.com:account-name/repo-name.git
什么好主意吗?
当前回答
我的代码片段:
environment {
...
...
git_repo = 'my-repo'
}
stage ('Update Helm Chart') {
steps {
echo 'Updating values.xml file with latest Docker image tag'
withCredentials([usernamePassword(credentialsId: '6bgg7dd45-c65f13-4275-a96ddehdv67gdr', usernameVariable: 'GIT_USER', passwordVariable: 'GIT_PASS')]) {
sh '''
git checkout ${git_branch}
...
...
git remote set-url origin "http://${GIT_USER}:${GIT_PASS}@git.example.com/scm/${git_repo}.git"
git push origin ${git_branch}
'''
}
}
}
我的Git用户名是deploy.user@example.com,所以我必须首先URL编码@ %40。在URL编码之后,我的用户名变成了deploy.user%40example.com。
然而,我仍然得到以下错误:
fatal: repository 'http://****:****@git.example.com/scm/my-repo.git/' not found
经过一些试验和错误,我发现,如果我不使用变量的用户名,而是硬编码它,它的工作。
git remote set-url origin "http://deploy.user%40example.com:${GIT_PASS}@git.example.com/scm/${git_repo}.git"
其他回答
这也可能发生,因为GitHub本身宕机了。一定要检查stat.github.com,看看问题是否在他们那边。
2018年10月22日,你有好几个小时都无法推送到GitHub。
我也遇到了同样的问题,尝试了很多方法,但最后,我知道我没有足够的权限来推或拉这个回购,还有一种方法来检查你是否有权限,你无法看到该回购中的设置选项,如果你有权限,那么你将能够看到设置选项
谢谢!这是我观察到的
我有这个问题,意识到我使用的是一个不同的帐户,其回购是。以原始用户身份登录解决了该问题。
如果你的repo之前工作正常,突然弹出这个错误,最有可能的原因是你的git被认证为其他用户,没有访问存储库的权限。因此,为了进行推送,您所需要做的就是在git命令中指定正确的用户名和密码。所以,一个github回购的推命令看起来像:
git push https://youruser:password@github.com/user/reponame.git
用户名和密码需要进行url转义,因此@应该被%40取代,等等。
SSH访问检查方法如下:
ssh -T git@github.com
这个问题是因为我没有在存储库中添加SSH上的人响应,阅读更多关于SSH link-1, link-2的信息。