libgit2 / libgit2/libgit2sharp

503 - During clone

未關閉
#1,682 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
C#
星號
3.5k
分支
925
PR 合併指標
30 天內沒有已合併 PR

描述

Version of LibGit2Sharp (release number or SHA1)

Master -7f59d22c

Operating system(s) tested; .NET runtime tested

I receive a "503" when trying to clone a repo from our self host git-service (gitea)

url looks like this:
https://{server}/git/{orga}/{repo}

cloning via git command line works without any problem:
git clone https://mytoken@{server}/git/{orga}/{repo}

i'm passing the token via cloneoptions.Credentialsprovider

 var co = new CloneOptions();
            co.CredentialsProvider = (_url, _user, _cred) =>
                new UsernamePasswordCredentials
                {
                    Username = "mytoken",
                    Password = string.Empty
                };

            string clonedRepoPath = Repository.Clone(url, scd.DirectoryPath, co);

Stacktrace:
LibGit2Sharp.LibGit2SharpException : request failed with status code: 503

   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in C:\Users\stefan.kneidl\Source\Repos\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 154
   at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result) in C:\Users\stefan.kneidl\Source\Repos\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 172
   at LibGit2Sharp.Core.Proxy.git_clone(String url, String workdir, GitCloneOptions& opts) in C:\Users\stefan.kneidl\Source\Repos\libgit2sharp\LibGit2Sharp\Core\Proxy.cs:line 276
   at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options) in C:\Users\stefan.kneidl\Source\Repos\libgit2sharp\LibGit2Sharp\Repository.cs:line 793
   at LibGit2Sharp.Tests.CloneFixture.CanCloneGitea(String url) in C:\Users\stefan.kneidl\Source\Repos\libgit2sharp\LibGit2Sharp.Tests\CloneFixture.cs:line 55

As additional information when trying to access the git server via browser:
https://{myserver}/git
returns: The service is not available. Please try again later.
https://{myserver}/git/ works as intended

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 LibGit2Sharp.Tests/CloneFixture.cs 中的 CanCloneGitea 開始,透過 Core/Proxy.cs 和 Core/Ensure.cs 追蹤 Repository.Clone。將失敗的自託管 URL 和 CredentialsProvider 與正常運作的命令列 clone 進行比較,包括伺服器對 /git 和 /git/ 回傳的不同回應。當 clone 行為得到解釋或修正,並由一個針對性的回歸測試涵蓋時,即視為完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
csharp, git
領域
devtools
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。