pygit2
pygit2 copied to clipboard
Connect to a git server in port other than 22
In git, there are two ways to connect/clone a remote repository:
git clone [email protected]:libgit2/pygit2.git
git clone ssh://[email protected]: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://[email protected]/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?