简体   繁体   English

使用Github API令牌的身份验证失败(非Web应用程序流程)

[英]Authentication failed using Github API Token (non web application flow)

We're having issues writing to a repository using our Github API Token, probably because what we're trying to achieve isn't possible. 我们使用Github API令牌写入存储库时遇到问题,可能是因为我们试图实现的目标是不可能的。 If it isn't feasible then I would like an explanation of why we can't perform the following: 如果这不可行,那么我想解释一下为什么我们不能执行以下操作:

We would want to avoid the Web Application Flow because what we want deems simple. 我们想要避免Web应用程序流,因为我们想要的东西很简单。 Ideally we would like to use our API token like this: 理想情况下,我们希望像这样使用我们的API令牌:

Following this guide: https://github.com/blog/1270-easier-builds-and-deployments-using-git-over-https-and-oauth If we scroll to the very bottom of "Using OAuth with Git", we will see: 遵循本指南: https : //github.com/blog/1270-easier-builds-and-deployments-using-git-over-https-and-oauth如果我们滚动到“在Git中使用OAuth”,我们会看到:

To avoid writing tokens to disk, don't clone. 为避免将令牌写入磁盘,请勿克隆。 Instead, just use the full git URL in your push/pull operations 相反,只需在推/拉操作中使用完整的git URL

As the doc states, we would like to perform push/pull operations. 如文档所述,我们想执行推/拉操作。 An example pull operation would be: 拉操作的示例为:

mkdir foo
cd foo
git init
git pull https://<token>@github.com/username/bar.git

Now we would want to perform a push operation (ie: something like below, as the documentation implies) 现在我们要执行推送操作(即:如文档所示,如下所示)

git add file
git commit file -m "Changed file"
git push https://<token>@github.com/username/bar.git master

The problem we're running into is on the push phase; 我们遇到的问题是在推送阶段。 we are stuck in performing the push operation. 我们被困在执行推操作中。 The error we receive is: 我们收到的错误是:

fatal: Authentication failed 严重:身份验证失败

What are we missing? 我们缺少什么? All we want is for the service account to perform push/pull operations via the documentation I provided above. 我们想要的只是让服务帐户通过我上面提供的文档执行推/拉操作。 The service account has been added (with read/write access) to our organization. 服务帐户已添加到我们的组织(具有读/写访问权限)。

Points worth mentioning: 值得一提的要点:

  • Our API token has "scope: repo" access. 我们的API令牌具有“作用域:回购”访问权限。
  • This example is from a Github Enterprise account. 此示例来自Github Enterprise帐户。

It appears to be related to the SSL not being enabled for our current version of Github Enterprise. 它似乎与我们当前版本的Github Enterprise未启用SSL有关。 The solution for my particular problem is to run on the latest version. 解决我特定问题的方法是在最新版本上运行。 This is something out of my hands but if someone encounters a similar problem, you should reach out to your employer's support desk. 这是我无法控制的,但是如果有人遇到类似的问题,则应联系雇主的支持部门。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM