class_docstr: Creates an instance of a remote Git repo for mounting to a submitted run.
  
  Using a locally checked-out remote Git repo:
  
  ```python
  repo=RemoteRepo.from_dir(repo_dir=".")
  ```
  
  Using a remote Git repo by a URL:
  
  ```python
  repo=RemoteRepo.from_url(
      repo_url="https://github.com/dstackai/dstack-examples",
      repo_branch="main"
  )
  ```
  
  Initialize the repo before mounting it.
  
  ```python
  client.repos.init(repo)
  ```
  
  By default, it uses the default Git credentials configured on the machine.
  You can override these credentials via the `git_identity_file` or `oauth_token` arguments of the `init` method.
  
  Finally, you can pass the repo object to the run:
  
  ```python
  run = client.runs.submit(
      configuration=...,
      repo=repo,
  )
  ```
docstr: Creates an instance of a remote repo from a URL.
  
  Args:
      repo_url: The URL of a remote Git repo
      repo_branch: The name of the remote branch. Must be specified if `hash` is not specified.
      repo_hash: The hash of the revision. Must be specified if `branch` is not specified.
  
  Returns:
      A remote repo instance
docstr_tok: ["Creates","an","instance","of","a","remote","repo","from","a","URL",".","Args",":","repo_url",":","The","URL","of","a","remote","Git","repo","repo_branch",":","The","name","of","the","remote","branch",".","Must","be","specified","if","`","hash","`","is","not","specified",".","repo_hash",":","The","hash","of","the","revision",".","Must","be","specified","if","`","branch","`","is","not","specified",".","Returns",":","A","remote","repo","instance"]
code: def from_url(
      repo_url: str,
      repo_branch: Optional[str] = None,
      repo_hash: Optional[str] = None,
  ) -> "RemoteRepo":
      """
      Creates an instance of a remote repo from a URL.
  
      Args:
          repo_url: The URL of a remote Git repo
          repo_branch: The name of the remote branch. Must be specified if `hash` is not specified.
          repo_hash: The hash of the revision. Must be specified if `branch` is not specified.
  
      Returns:
          A remote repo instance
      """
      if repo_branch is None and repo_hash is None:
          raise ValueError(
              "Either `repo_branch` or `repo_hash` must be specified."
          )
      return RemoteRepo(
          repo_url=repo_url,
          repo_branch=repo_branch,
          repo_hash=repo_hash,
      )
  
imports: import io
  import subprocess
  import time
  from typing import BinaryIO, Optional
  import git
  import giturlparse
  from pydantic import BaseModel, Field
  from typing_extensions import Literal
  from dstack._internal.core.errors import DstackError
  from dstack._internal.core.models.repos.base import BaseRepoInfo, Repo, RepoProtocol
  from dstack._internal.utils.hash import get_sha256, slugify
  from dstack._internal.utils.path import PathLike
  from dstack._internal.utils.ssh import get_host_config
label_desc: Use image node_id 2 for calling the RemoteRepo obj's underlying member method code with example usage: obj.from_url(repo_url, repo_branch, repo_hash) and returns: RemoteRepo