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,
  )
  ```
code: def __init__(
      self,
      *,
      repo_id: Optional[str] = None,
      local_repo_dir: Optional[PathLike] = None,
      repo_url: Optional[str] = None,
      repo_data: Optional[RemoteRunRepoData] = None,
      repo_branch: Optional[str] = None,
      repo_hash: Optional[str] = None,
  ):
      self.repo_dir = local_repo_dir
      self.repo_url = repo_url
  
      if self.repo_dir is not None:
          repo = git.Repo(self.repo_dir)
          tracking_branch = repo.active_branch.tracking_branch()
          if tracking_branch is None:
              raise RepoError("No remote branch is configured")
          self.repo_url = repo.remote(tracking_branch.remote_name).url
          repo_data = RemoteRunRepoData.from_url(
              self.repo_url, parse_ssh_config=True
          )
          repo_data.repo_branch = tracking_branch.remote_head
          repo_data.repo_hash = tracking_branch.commit.hexsha
          repo_data.repo_config_name = (
              repo.config_reader().get_value("user", "name", "") or None
          )
          repo_data.repo_config_email = (
              repo.config_reader().get_value("user", "email", "")
              or None
          )
          repo_data.repo_diff = _repo_diff_verbose(
              repo, repo_data.repo_hash
          )
      elif self.repo_url is not None:
          repo_data = RemoteRunRepoData.from_url(
              self.repo_url, parse_ssh_config=True
          )
          if repo_branch is not None:
              repo_data.repo_branch = repo_branch
          if repo_hash is not None:
              repo_data.repo_hash = repo_hash
      elif repo_data is None:
          raise RepoError("No remote repo data provided")
  
      if repo_id is None:
          repo_id = slugify(repo_data.repo_name, repo_data.path("/"))
      self.repo_id = repo_id
      self.run_repo_data = repo_data
  
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 3 to create a new RemoteRepo object from inherited base classes: Repo with example: obj = RemoteRepo()