Clones a new Git repository from *url* in the given *path*. Returns: a Repository class pointing to the newly cloned repository. Parameters: url : str or bytes or pathlike object URL of the repository to clone. path : str or bytes or pathlike object Local path
(
url: str | bytes | os.PathLike[str] | os.PathLike[bytes],
path: str | bytes | os.PathLike[str] | os.PathLike[bytes],
bare: bool = False,
repository: typing.Callable | None = None,
remote: typing.Callable | None = None,
checkout_branch: str | bytes | None = None,
callbacks: RemoteCallbacks | None = None,
depth: int = 0,
proxy: None | bool | str = None,
)
| 460 | |
| 461 | |
| 462 | def clone_repository( |
| 463 | url: str | bytes | os.PathLike[str] | os.PathLike[bytes], |
| 464 | path: str | bytes | os.PathLike[str] | os.PathLike[bytes], |
| 465 | bare: bool = False, |
| 466 | repository: typing.Callable | None = None, |
| 467 | remote: typing.Callable | None = None, |
| 468 | checkout_branch: str | bytes | None = None, |
| 469 | callbacks: RemoteCallbacks | None = None, |
| 470 | depth: int = 0, |
| 471 | proxy: None | bool | str = None, |
| 472 | ) -> Repository: |
| 473 | """ |
| 474 | Clones a new Git repository from *url* in the given *path*. |
| 475 | |
| 476 | Returns: a Repository class pointing to the newly cloned repository. |
| 477 | |
| 478 | Parameters: |
| 479 | |
| 480 | url : str or bytes or pathlike object |
| 481 | URL of the repository to clone. |
| 482 | path : str or bytes or pathlike object |
| 483 | Local path to clone into. |
| 484 | bare : bool |
| 485 | Whether the local repository should be bare. |
| 486 | remote : callable |
| 487 | Callback for the remote to use. |
| 488 | |
| 489 | The remote callback has `(Repository, name, url) -> Remote` as a |
| 490 | signature. The Remote it returns will be used instead of the default |
| 491 | one. |
| 492 | repository : callable |
| 493 | Callback for the repository to use. |
| 494 | |
| 495 | The repository callback has `(path, bare) -> Repository` as a |
| 496 | signature. The Repository it returns will be used instead of creating a |
| 497 | new one. |
| 498 | checkout_branch : str or bytes |
| 499 | Branch to checkout after the clone. The default is to use the remote's |
| 500 | default branch. |
| 501 | callbacks : RemoteCallbacks |
| 502 | Object which implements the callbacks as methods. |
| 503 | |
| 504 | The callbacks should be an object which inherits from |
| 505 | `pyclass:RemoteCallbacks`. |
| 506 | depth : int |
| 507 | Number of commits to clone. |
| 508 | |
| 509 | If greater than 0, creates a shallow clone with a history truncated to |
| 510 | the specified number of commits. |
| 511 | The default is 0 (full commit history). |
| 512 | proxy : None or True or str |
| 513 | Proxy configuration. Can be one of: |
| 514 | |
| 515 | * `None` (the default) to disable proxy usage |
| 516 | * `True` to enable automatic proxy detection |
| 517 | * an url to a proxy (`http://proxy.example.org:3128/`) |
| 518 | """ |
| 519 |
searching dependent graphs…