我正在用给定的golang代码克隆公共gitrepo:(这很好)
_, err = git.PlainClone(projectRoot, false, &git.CloneOptions{
URL: e.Repo,
Progress: os.Stdout,
})对于私有的given,我正在生成一个OAuth令牌和下面提供的代码:
_, err = git.PlainClone(projectRoot, false, &git.CloneOptions{
Auth: &gitHttp.TokenAuth{Token: <oauth-token>},
URL: e.Repo,
Progress: os.Stdout,
})这给了我这样的感觉:
unexpected client error: unexpected requesting "https://github.com/.../info/refs?service=git-upload-pack" status code: 400我正在使用这些特定的模块
git "github.com/go-git/go-git/v5"
gitHttp "github.com/go-git/go-git/v5/plumbing/transport/http"发布于 2021-10-12 08:23:14
_, err = git.PlainClone(projectRoot, false, &git.CloneOptions{
Auth: &gitHttp.BasicAuth{Username: <username>, Password: <oauth-token>},
URL: e.Repo,
Progress: os.Stdout,
})https://stackoverflow.com/questions/69528683
复制相似问题