# Update Git repository settings

This function modifies a Git™ repository's basic settings. For more information about support
for version control in cPanel & WHM, read our
Git Version Control
and Guide to Git documentation.

Note:

* This function only pulls changes from the remote repository if you specify a branch value.
* You cannot modify the type, repository_root, or url values for existing repositories.
* You must include the repository_root parameter in order to identify the repository to
update.
* All other input parameters are optional. Use them to assign the new values to the
account. If you do not include a parameter or specify its existing value, no change will occur.

Endpoint: GET /VersionControl/update
Version: 11.138.0.10
Security: BasicAuth

## Query parameters:

  - `repository_root` (string, required)
    The absolute directory path that contains the repository to update.
    Example: "/home/user/public_html/example"

  - `branch` (string)
    The new branch to use.

If you do not specify a value, the function does not update this parameter.

Remember:

This function only pulls changes from the remote repository if you specify
this value.
    Example: "master"

  - `name` (string)
    The repository's new display name.

If you do not specify a value, the function does not update this parameter.
    Example: "example"

  - `source_repository` (object)
    A JSON-encoded object containing information about the source repository.

If you do not specify a value, the function does not update this parameter.

Important:

* You cannot modify the source repository's URL.
* You must JSON-encode the contents of this object.
    Example: {"remote_name":"origin"}

## Response 200 fields (application/json):

  - `apiversion` (integer)
    The version of the API.
    Example: 3

  - `func` (string)
    The name of the method called.
    Example: "update"

  - `module` (string)
    The name of the module called.
    Example: "VersionControl"

  - `result` (object)

  - `result.data` (object)
    Example: {"available_branches":["master"],"branch":"master","clone_urls":{"read_only":["https://user@example.com/home/user/example"],"read_write":["ssh://user@example.com/home/user/example"]},"deployable":1,"last_deployment":{"deployment_date":1569844800,"repository_state":{"author":"User Name <user.name@example.com>","date":1569844800,"identifier":"2fd4e1c67a2d28fced849ee1bb76e7391b93eb121","message":"I'm committing some particularly cromulent code."}},"last_update":{"author":"Jane Doe <jane.doe@example.com>","date":1569844800,"identifier":"2fd4e1c67a2d28fced849ee1bb76e7391b93eb12","message":"I'm committing some particularly cromulent code."},"name":"example","repository_root":"/home/user/example","tasks":[{"action":"create","args":{"repository_root":"/home/user/example"},"id":"00000000/5a9ec8dd4c345d","subsystem":"VersionControl"}],"type":"git"}

  - `result.data.available_branches` (array)
    A list of local and remote branches available for the cloned or
existing repository.

* An empty array, if no branches exist.
* null — The repository is a bare repository.
    Example: ["master"]

  - `result.data.branch` (string,null)
    The repository's current branch.

* null — The system has not finished the clone process for the
repository, no local branches exist, or the repository is a bare
repository.
    Example: "master"

  - `result.data.clone_urls` (object)
    An object containing the URLs to use to clone the repository.

The function returns an empty object if the account does not
include the Shell Access setting.

Important:

If the server uses a nonstandard SSH port, the system returns a
clone URL that includes the port number.
    Example: {"read_only":["https://user@example.com/home/user/example"],"read_write":["ssh://user@example.com/home/user/example"]}

  - `result.data.clone_urls.read_only` (array)
    A list of clone URLs with read-only permissions.

This function returns an empty list if the account does
not include the Shell Access setting.

Important:

If the server uses a nonstandard SSH port, the system returns a
clone URL that includes the port number.
    Example: ["https://user@example.com/home/user/example"]

  - `result.data.clone_urls.read_write` (array)
    A list of clone URLs with read-write permissions.

This function returns an empty list if the account does
not include the Shell Access setting.

Important:

If the server uses a nonstandard SSH port, the system returns a
clone URL that includes the port number.
    Example: ["ssh://user@example.com/home/user/example"]

  - `result.data.deployable` (integer)
    Whether the system could deploy the repository.

* 1 — Can deploy.
* 0 — Cannot deploy.
    Enum: 1, 0

  - `result.data.last_deployment` (object,null)
    An object containing information about the commit that the system
most recently deployed.

Note:

If no deployment information exists, the function returns a null value.
    Example: {"deployment_date":1569844800,"repository_state":{"author":"User Name <user.name@example.com>","date":1569844800,"identifier":"2fd4e1c67a2d28fced849ee1bb76e7391b93eb121","message":"I'm committing some particularly cromulent code."}}

  - `result.data.last_deployment.deployment_date` (integer)
    The timestamp for the most recent deployment.
    Example: 1569844800

  - `result.data.last_deployment.repository_state` (object)
    A object containing information about the state of the repository at the time of the most recent deployment.
    Example: {"author":"User Name <user.name@example.com>","date":1569844800,"identifier":"2fd4e1c67a2d28fced849ee1bb76e7391b93eb121","message":"I'm committing some particularly cromulent code."}

  - `result.data.last_deployment.repository_state.author` (string)
    The author's name and email address for the commit that the system most recently deployed.
    Example: "User Name <user.name@example.com>"

  - `result.data.last_deployment.repository_state.date` (integer)
    The timestamp for the commit that the system most recently deployed.
    Example: 1569844800

  - `result.data.last_deployment.repository_state.identifier` (string)
    The identifier (SHA-1 value) for the commit that the system most recently deployed.
    Example: "2fd4e1c67a2d28fced849ee1bb76e7391b93eb121"

  - `result.data.last_deployment.repository_state.message` (string)
    The commit message for the commit that the system most recently deployed.
    Example: "I'm committing some particularly cromulent code."

  - `result.data.last_update` (object,null)
    An object containing information about the most recent (HEAD) commit for
the current branch.

Note:

This object's information resembles the output of the git log -1
command.

Important:

* If the repository does not include any commits, the function
returns a null value instead of an object.
* The system may require a large amount of time to clone larger repositories.
Until this process finishes, HEAD information is unavailable.
    Example: {"author":"Jane Doe <jane.doe@example.com>","date":1569844800,"identifier":"2fd4e1c67a2d28fced849ee1bb76e7391b93eb12","message":"I'm committing some particularly cromulent code."}

  - `result.data.last_update.author` (string)
    The most recent commit's author name and email address.
    Example: "Jane Doe <jane.doe@example.com>"

  - `result.data.last_update.date` (integer)
    The timestamp for the most recent commit.
    Example: 1569844800

  - `result.data.last_update.identifier` (string)
    The identifier (SHA-1 value) for the most recent commit.
    Example: "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"

  - `result.data.last_update.message` (string)
    The commit message.
    Example: "I'm committing some particularly cromulent code."

  - `result.data.name` (string)
    The repository's display name.
    Example: "example"

  - `result.data.repository_root` (string)
    The directory path that exists in the user's home directory containing the repository.
    Example: "/home/user/example"

  - `result.data.source_repository` (object)
    An object containing information about the source repository.

Note:

The function only returns this object if you cloned a source
repository.

  - `result.data.source_repository.remote_name` (string)
    The source repository's name.

  - `result.data.source_repository.url` (string)
    The source repository's clone URL.

  - `result.data.tasks` (array)
    An array of objects containing information about the
[Task Queue](https://go.cpanel.net/whmdocsTaskQueueMonitor)
system's process that will clone the repository.

Note:

The function only returns this value if the clone process is
not finished.
    Example: [{"action":"create","args":{"repository_root":"/home/user/example"},"id":"00000000/5a9ec8dd4c345d","subsystem":"VersionControl"}]

  - `result.data.tasks.action` (string)
    The task's action.

* create — Create the repository.
* deploy — Deploy the repository.
    Enum: "create", "deploy"

  - `result.data.tasks.args` (object)
    An object containing arguments for the Task Queue system's process.

  - `result.data.tasks.args.log_file` (string)
    The absolute path to the process log file in the user's
home directory.

Note:

The function only returns this value if the process
generated a log file.

  - `result.data.tasks.args.repository_root` (string)
    The repository's absolute directory path in the user's home directory.

  - `result.data.tasks.id` (string)
    The Task Queue system's task ID number.

  - `result.data.tasks.subsystem` (string)
    The Task Queue subsystem that will handle the task.

* VersionControl

Note:

* VersionControl is the only possible value.
    Enum: "VersionControl"

  - `result.data.type` (string)
    The repository type.

* git — A [Git](https://git-scm.com/) repository.

Note:

* git is the only possible value.
    Enum: "git"

  - `result.errors` (array,null)
    List of errors if the API failed.

  - `result.messages` (array,null)
    List of messages generated by the API.

  - `result.metadata` (object)

  - `result.status` (integer)
    * 1 — Success.
* 0 — Failed. Check the errors field for more details.
    Enum: 1, 0

  - `result.warnings` (array,null)
    List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API.


