libgit2 / libgit2/libgit2sharp

503 - During clone

Open
#1,682 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with LibGit2Sharp.Tests/CloneFixture.cs at CanCloneGitea and trace Repository.Clone through Core/Proxy.cs and Core/Ensure.cs. Compare the failing self-hosted URL and CredentialsProvider with the working command-line clone, including the server's differing /git and /git/ responses. Done means the clone behavior is explained or corrected and covered by a focused regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.