On this page:
git_  remote_  add_  fetch
git_  remote_  add_  push
git_  remote_  autotag
git_  remote_  connect
git_  remote_  connected
git_  remote_  create
git_  remote_  create_  anonymous
git_  remote_  create_  with_  fetchspec
git_  remote_  default_  branch
git_  remote_  delete
git_  remote_  disconnect
git_  remote_  download
git_  remote_  dup
git_  remote_  fetch
git_  remote_  free
git_  remote_  get_  fetch_  refspecs
git_  remote_  get_  push_  refspecs
git_  remote_  get_  refspec
git_  remote_  init_  callbacks
git_  remote_  is_  valid_  name
git_  remote_  list
git_  remote_  lookup
git_  remote_  ls
git_  remote_  name
git_  remote_  owner
git_  remote_  prune
git_  remote_  prune_  refs
git_  remote_  push
git_  remote_  pushurl
git_  remote_  refspec_  count
git_  remote_  rename
git_  remote_  set_  autotag
git_  remote_  set_  pushurl
git_  remote_  set_  url
git_  remote_  stats
git_  remote_  stop
git_  remote_  update_  tips
git_  remote_  upload
git_  remote_  url
git_  fetch_  init_  options
git_  push_  init_  options
8.12

36 Remote🔗ℹ

 (require libgit2/include/remote) package: libgit2

procedure

(git_remote_add_fetch repo remote refspec)  integer?

  repo : repository?
  remote : string?
  refspec : string?
Add a fetch refspec to the remote’s configuration

Add the given refspec to the fetch list in the configuration. No loaded remote instances will be affected.

procedure

(git_remote_add_push repo remote refspec)  integer?

  repo : repository?
  remote : string?
  refspec : string?
Add a push refspec to the remote’s configuration

Add the given refspec to the push list in the configuration. No loaded remote instances will be affected.

procedure

(git_remote_autotag remote)  git_remote_autotag_opt_t

  remote : remote?
Retrieve the tag auto-follow setting

procedure

(git_remote_connect remote    
  direction    
  callbacks    
  proxy_opts    
  custom_headers)  integer?
  remote : remote?
  direction : git_direction
  callbacks : remote_callbacks?
  proxy_opts : git_proxy_opts?
  custom_headers : strarray?
Open a connection to a remote

The transport is selected based on the URL. The direction argument is due to a limitation of the git protocol (over TCP or SSH) which starts up a specific binary which can only do the one or the other.

procedure

(git_remote_connected remote)  boolean?

  remote : remote?
Check whether the remote is connected

Check whether the remote’s underlying transport is connected to the remote host.

procedure

(git_remote_create repo name url)  remote?

  repo : repository?
  name : string?
  url : string?
Add a remote with the default fetch refspec to the repository’s configuration.

procedure

(git_remote_create_anonymous repo url)  remote?

  repo : repository?
  url : string?
Create an anonymous remote

Create a remote with the given url in-memory. You can use this when you have a URL instead of a remote’s name.

procedure

(git_remote_create_with_fetchspec repo    
  name    
  url    
  fetch)  remote?
  repo : repository?
  name : string?
  url : string?
  fetch : string?
Add a remote with the provided fetch refspec (or default if NULL) to the repository’s configuration.

procedure

(git_remote_default_branch out remote)  integer?

  out : buf?
  remote : remote?
Retrieve the name of the remote’s default branch

The default branch of a repository is the branch which HEAD points to. If the remote does not support reporting this information directly, it performs the guess as git does; that is, if there are multiple branches which point to the same commit, the first one is chosen. If the master branch is a candidate, it wins.

This function must only be called after connecting.

procedure

(git_remote_delete repo name)  integer?

  repo : repository?
  name : string?
Delete an existing persisted remote.

All remote-tracking branches and configuration settings for the remote will be removed.

procedure

(git_remote_disconnect remote)  void?

  remote : remote?
Disconnect from the remote

Close the connection to the remote.

procedure

(git_remote_download remote refspecs opts)  integer?

  remote : remote?
  refspecs : strarray?
  opts : (or/c git_fetch_opts? #f)
Download and index the packfile

Connect to the remote if it hasn’t been done yet, negotiate with the remote git which objects are missing, download and index the packfile.

The .idx file will be created and both it and the packfile with be renamed to their final name.

procedure

(git_remote_dup source)  remote?

  source : remote?
Create a copy of an existing remote. All internal strings are also duplicated. Callbacks are not duplicated.

Call git_remote_free to free the data.

procedure

(git_remote_fetch remote    
  refspecs    
  opts    
  reflog_message)  integer?
  remote : remote?
  refspecs : (or/c strarray? #f)
  opts : (or/c git_fetch_options? #f)
  reflog_message : (or/c string? #f)
Download new data and update tips

Convenience function to connect to a remote, download the data, disconnect and update the remote-tracking branches.

procedure

(git_remote_free remote)  void?

  remote : remote?
Free the memory associated with a remote

This also disconnects from the remote, if the connection has not been closed yet (using git_remote_disconnect).

procedure

(git_remote_get_fetch_refspecs array    
  remote)  integer?
  array : strarray?
  remote : remote?
Get the remote’s list of fetch refspecs

The memory is owned by the user and should be freed with git_strarray_free.

procedure

(git_remote_get_push_refspecs array remote)  integer?

  array : strarray?
  remote : remote?
Get the remote’s list of push refspecs

The memory is owned by the user and should be freed with git_strarray_free.

procedure

(git_remote_get_refspec remote n)  integer?

  remote : remote?
  n : integer?
Get a refspec from the remote

procedure

(git_remote_init_callbacks opts version)  integer?

  opts : git_remote_callbacks?
  version : integer?
Initializes a git_remote_callbacks with default values. Equivalent to creating an instance with GIT_REMOTE_CALLBACKS_INIT.

procedure

(git_remote_is_valid_name remote_name)  boolean?

  remote_name : string?
Ensure the remote name is well-formed.

procedure

(git_remote_list out repo)  integer?

  out : strarray?
  repo : repository?
Get a list of the configured remotes for a repo

The string array must be freed by the user.

procedure

(git_remote_lookup repo name)  remote?

  repo : repository?
  name : string?
Get the information for a particular remote

The name will be checked for validity. See git_tag_create() for rules about valid names.

procedure

(git_remote_ls remote)  any

  remote : remote?
Get the remote repository’s reference advertisement list

Get the list of references with which the server responds to a new connection.

The remote (or more exactly its transport) must have connected to the remote repository. This list is available as soon as the connection to the remote is initiated and it remains available after disconnecting.

The memory belongs to the remote. The pointer will be valid as long as a new connection is not initiated, but it is recommended that you make a copy in order to make use of the data.

Returns (values (out : (cpointer remote_head?)) (size : integer?)). See Multiple Values

procedure

(git_remote_name remote)  string?

  remote : remote?
Get the remote’s name

procedure

(git_remote_owner remote)  repository?

  remote : remote?
Get the remote’s repository

procedure

(git_remote_prune remote callbacks)  integer?

  remote : remote?
  callbacks : (or/c git_remote_callbacks? #f)
Prune tracking refs that are no longer present on remote

procedure

(git_remote_prune_refs remote)  integer?

  remote : remote?
Retrieve the ref-prune setting

procedure

(git_remote_push remote refspecs opts)  integer?

  remote : remote?
  refspecs : strarray?
  opts : (or/c git_push_opns? #f)
Perform a push

Peform all the steps from a push.

procedure

(git_remote_pushurl remote)  string?

  remote : remote?
Get the remote’s url for pushing

If url.*.pushInsteadOf has been configured for this URL, it will return the modified URL.

procedure

(git_remote_refspec_count remote)  integer?

  remote : remote?
Get the number of refspecs for a remote

procedure

(git_remote_rename problems    
  repo    
  name    
  new_name)  integer?
  problems : strarray?
  repo : repository?
  name : string?
  new_name : string?
Give the remote a new name

All remote-tracking branches and configuration settings for the remote are updated.

The new name will be checked for validity. See git_tag_create() for rules about valid names.

No loaded instances of a the remote with the old name will change their name or their list of refspecs.

procedure

(git_remote_set_autotag repo remote value)  integer?

  repo : repository?
  remote : string?
  value : git_remote_autotag_option_t
Set the remote’s tag following setting.

The change will be made in the configuration. No loaded remotes will be affected.

procedure

(git_remote_set_pushurl repo remote url)  integer?

  repo : repository?
  remote : string?
  url : string?
Set the remote’s url for pushing in the configuration.

Remote objects already in memory will not be affected. This assumes the common case of a single-url remote and will otherwise return an error.

procedure

(git_remote_set_url repo remote url)  integer?

  repo : repository?
  remote : string?
  url : string?
Set the remote’s url in the configuration

Remote objects already in memory will not be affected. This assumes the common case of a single-url remote and will otherwise return an error.

procedure

(git_remote_stats remote)  git_transfer_progress?

  remote : remote?
Get the statistics structure that is filled in by the fetch operation.

procedure

(git_remote_stop remote)  void?

  remote : remote?
Cancel the operation

At certain points in its operation, the network code checks whether the operation has been cancelled and if so stops the operation.

procedure

(git_remote_update_tips remote    
  callbacks    
  update_fetchhead    
  download_tags    
  reflog_message)  integer?
  remote : remote?
  callbacks : git_remote_callbacks?
  update_fetchhead : boolean?
  download_tags : git_remote_autotag_option_t
  reflog_message : string?
Update the tips to the new state

procedure

(git_remote_upload remote refspecs opts)  integer?

  remote : remote?
  refspecs : strarray?
  opts : git_push_options?
Create a packfile and send it to the server

Connect to the remote if it hasn’t been done yet, negotiate with the remote git which objects are missing, create a packfile with the missing objects and send it.

procedure

(git_remote_url remote)  string?

  remote : remote?
Get the remote’s url

If url.*.insteadOf has been configured for this URL, it will return the modified URL.

procedure

(git_fetch_init_options opts version)  integer?

  opts : git_fetch_opts?
  version : integer?
Initializes a git_fetch_options struct.

procedure

(git_push_init_options opts version)  integer?

  opts : git_push_opts?
  version : integer?
Initializes a git_fetch_options struct.