- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我正在尝试使用 go-git
从 GitHub Enterprise 克隆存储库。为此,我使用带有访问 token 的 HTTPS 协议(protocol),该 token 对我的存储库具有适当的权限(在命令行上验证)。 go-git
在进行 git-upload-pack
RPC 调用时失败,因为服务器以 400 响应:
$ go run main.go
unexpected client error: unexpected requesting "https://github.mycompany.net/my-org/myrepo.git/info/refs?service=git-upload-pack" status code: 400
它发出的请求等同于:
GET /my-org/myrepo.git/info/refs?service=git-upload-pack HTTP/1.1
Host: github.mycompany.net
User-Agent: git/1.0
Accept: */*
Authorization: Bearer atokenthatisdefinitelyvalid
如果请求 header 中没有 token ,我会从存储库中得到预期的 401(Anonymous access denied
)响应。使用 token ,它以 400 响应。
我发现非企业 GitHub 上的公共(public)存储库也是如此;不同之处在于它(预期)在没有 Authorization
header 的情况下工作,因为没有必要。如果我包含一个有效的 token ,GitHub 就像它的企业版一样以 400 响应。
下面是一个最小的例子。有没有办法将 go-git
与需要身份验证的 GitHub Enterprise 一起使用?理想情况下使用身份验证 token ?
package main
import (
"fmt"
"io/ioutil"
git "gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/transport/http"
)
const (
repoURL = "https://github.mycompany.net/my-org/myrepo.git"
githubAccessToken = "atokenthatisdefinitelyvalid"
)
func main() {
dir, _ := ioutil.TempDir("", "temp_dir")
options := &git.CloneOptions{
Auth: &http.TokenAuth{Token: githubAccessToken},
URL: repoURL,
Depth: 500,
ReferenceName: plumbing.ReferenceName("refs/heads/master"),
SingleBranch: true,
Tags: git.NoTags,
}
_, err := git.PlainClone(dir, false, options)
fmt.Println(err)
}
最佳答案
事实证明,Github 使用 token 作为您用户的密码,因此它需要基本身份验证而不是 header 中的 token :
options := &git.CloneOptions{
Auth: &http.BasicAuth{Username: "myusername", Token: "mytoken"},
URL: repoURL,
Depth: 500,
ReferenceName: plumbing.ReferenceName("refs/heads/master"),
SingleBranch: true,
Tags: git.NoTags,
}
关于git - 使用 go-git 从 GitHub Enterprise 克隆存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51751828/
Enterprise Architect 中的原型(prototype)“主文档”和“报告包”有什么区别?我将从多个模型文档生成一个文档,我想更好地组织它们以模仿生成的文档的结构。我认为创建“报告包”
Stackoverflow 上有几个问题询问 x ( Ruby/Drupal ) 技术是否已“企业就绪”。 我想问一下“企业就绪”是如何定义的。 有人创建了自己的 list 吗? 有人有测试的基准吗?
我要为我的 EA 项目创建一个脚本。为此,有必要创建一个新的“组”,您可以在该组中添加自己的脚本。 我在硬盘上找到的本地脚本。它们位于 EA-install-dir/Scritps 中。 但是我在哪里
我定义了一个带有操作的类,操作在几个时序图中使用。 有没有办法找出有多少序列图正在使用一个特定的操作? 最佳答案 如果我的理解正确,您应该能够执行以下操作: 在“项目浏览器”中展开您的类以查看操作 右
问题:我们的许多设计和架构文档都是在 Enterprise Architect 中创建和维护的。 ——无论好坏,就是这样。这些文档存储在我们的 subversion 存储库中——这对于创建和更新它们的
运行 Github Enterprise 2.18。有什么方法可以通过 API 确定用户处于休眠状态吗?我在任何地方都没有看到对它的具体调用... 最佳答案 为了回答你的问题...... Runnin
我有一个很大的遗留项目。 我加载了整个项目:Project->Source Code Engineering->Import Source Directory:(c++) & (path) 有没有一种
我的元素有 10 个或更多标记值,而不是一次删除一个,有没有办法同时删除它们? 最佳答案 正如 Uffe 指出的那样,您可以使用脚本来完成此操作。有关 EA 脚本的更多信息,请参阅 the EA Us
我有一些代码,我想创建Property Note var metric as EA.Element; metric = thePackage.Elements.AddNew("", "Text")
我正在尝试将一个图表中的用例链接到详细说明该用例的图表。 我正在做的是: 创建新的用例图(右键单击模型 -> 添加 -> 添加图) 将图表称为“测试” 在图表中添加用例(在图表中单击右键 -> 新建元
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
我无法在“Enterprise Architect”(Sparx Systems)生成的类图中显示参数的名称。我正在尝试在下面添加一个操作 + delayFight(numberOfMinutes:
我正在阅读 Scylla 的文档,因为我们正计划从 DSE 迁移到本地 Scylla。然而,in their documentation ,他们说不支持 DSE SSTable 格式。 Here他们提
在模型搜索功能中似乎没有办法将结果限制为特定类型,例如类,节点等。有办法实现吗?我知道我可以制作一个 SQL 查询,但是无法找到正确的表名。 编辑 看来我可以做到以下几点 选择 *, Object_T
一些扩展 GitHub Enterprise 的服务需要足够新的版本。但作为 GH:E 的标准用户,我如何在不干扰管理员的情况下确定我的公司安装了哪个版本? 最佳答案 我正在为我们的 github 企
我正在阅读 Scylla 的文档,因为我们正计划从 DSE 迁移到本地 Scylla。然而,in their documentation ,他们说不支持 DSE SSTable 格式。 Here他们提
我有一个 54 页的 UML 图要打印。我想缩小图像大小或页面大小,以便打印不超过 12 页?有没有办法做到这一点? 最佳答案 开图 使用图->属性 在图表选项卡上,单击页面设置下的“高级...” 单
我有一个用例图,其中用例具有扩展关系。我想知道是否有任何 API 可用于了解将哪个扩展点设置为特定的扩展关系(在许多可以应用的扩展点中)。下面显示了用例图以及突出显示的扩展点。 最佳答案 假设这是一个
我正在尝试使用 Microsoft Enterprise Library 中的 DatabaseFactory 方法。 using Microsoft.Practices.EnterpriseLibr
有谁知道如何在使用 amazon ec2 M3.Xlarge 机器的集群中使用 Datastax 企业(使用 opscenter)? 当我尝试使用这些类型的实例(使用 ssd)时,出现以下错误: 启动
我是一名优秀的程序员,十分优秀!