libgit2 / libgit2/pygit2

Connect to a git server in port other than 22

Open
#926 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.7k
Forks
408
Avg merge
2d 57m
Merged PRs (30d)
7

Description

In git, there are two ways to connect/clone a remote repository:

git clone git@git-in-port-22.com:libgit2/pygit2.git
git clone ssh://git@git-in-another-port.com:2345/libgit2/pygit2.git

and the 2nd one support to connect to a remote git server which is not in port 22.

In pygit2 doc, the connection is through

pygit2.clone_repository("ssh://git@github.com/libgit2/pygit2", "pygit2.git",
                        callbacks=callbacks)

After confirmed git clone ssh://git@localhost:8822/home/git/server.git can succeed, I tried

pygit2.clone_repository("ssh://git@localhost:8822/home/git/", "server.git")

but

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pygit2/__init__.py", line 263, in clone_repository
    check_error(err)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pygit2/errors.py", line 64, in check_error
    raise GitError(message)
_pygit2.GitError: unsupported URL protocol

I wonder if there's a way to specify a customized port?

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 at the pygit2.clone_repository entry point and reproduce the reported ssh://localhost:8822 clone command. Trace how the URL is parsed and passed to the SSH transport, then verify that cloning from a non-22 port succeeds without the unsupported URL protocol error.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.