cPanel/VersionControl
cPanel module

VersionControl

4 functions, invoked through the cpanel_uapi tool.

scope cpanel:uapi
Call any function with cpanel_uapi(service_id, module="VersionControl", function, params). Live availability depends on the cPanel features JetHost has enabled on your account — call list_cpanel_operations to see what is active.

create GET#

Create Git repository

This function creates a new Git™ repository on a cPanel account.

  • For more information about support for version control in cPanel & WHM, read our

Git Version Control and Guide to Git documentation.

  • For a list of configuration changes, repository restrictions, and troubleshooting steps,

read our Guide to Git - For System Administrators documentation.

Important:

The system logs errors for this function in the ~/.cpanel/logs/vc_TIMESTAMP_git_create.log file, where TIMESTAMP represents the time of the error in Unix epoch time.

namestringRequired
The new repository's display name.
repository_rootstringRequired
The absolute path to the directory in which to store the repository, relative to the user's home directory. Note: If the directory does not exist, the system will create it. If the specified directory already contains a repository, the system will automatically add it to the list of cPanel-managed repositories. * This feature enforces several restrictions on repository paths. For more information, read our Guide to Git - For System Administrators documentation.
typestringRequired
The repository type. * git — A Git repository. Note: git is the only possible value.
source_repositorymixedOptional
A JSON-formatted object containing information about the source repository that the system will clone. Note: If you do not include source repository data, the function creates an empty repository.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

available_branchesarray<string>
An list of available branches for the cloned or existing repository, if any exist.
branchstring
The repository's current branch. * null — The system has not finished the clone process for the repository, or no local branches exist.
clone_urlsobject
An object containing URLs to use to clone the repository.
read_onlyarray<string>
A list of clone URLs with read-only permissions. The function returns a blank array 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.
read_writearray<string>
A list of of clone URLs with read-write permissions. The function returns a blank array 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.
last_updateany
Information about the most-recent (HEAD) commit for the current branch. Note: The system may require a large amount of time to clone large repositories. Until this process finishes, HEAD information is unavailable. null is the only possible value.
One of:
namestring
The repository's display name.
repository_rootstring
The absolute path of the directory that contains the repository in the user's home directory.
source_repositoryobject
A object containing information about a cloned repository's source repository. Note: The function only returns this object if it will clone a repository.
remote_namestring
The source repository's name.
urlstring
The source repository's clone URL.
tasksarray<object>
An array of objects containing information about the Task Queue system's process that will clone the repository. Note: The function only returns this value if it will clone a repository.
actionstring
The task's action. * create Note: create is the only possible value.
One of: create
argsobject
A list of arguments for the Task Queue system's process.
log_filestring
The absolute path to the process's log file. Note: The function only returns this value if the process generated a log file.
repository_rootstring
The absolute path to the repository's directory within the user's home directory.
idstring
The Task Queue system's task ID number.
sse_urlstring
The SSE interface to track the progress of the process.
subsystemstring
The Task Queue subsystem that will handle the task. * VersionControl Note: VersionControl is the only possible value.
One of: VersionControl
typestring
The repository type. * git — A Git repostiory. Note: git is the only possible value.

delete GET#

Delete Git repository

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

Warning:

  • When you call this function, the system permanently deletes the entire contents

of the specified directory. You cannot recover this data after deletion.

  • You cannot use this function to delete any repositories that do not appear in

the cache of repositories (for example, repositories that contain invalid characters or exist within cPanel-controlled directories).

repository_rootstringRequired
The absolute directory path in the user's home directory containing the repository to delete.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

retrieve GET#

Return Git repositories

This function lists Git™ repositories on a cPanel account. For more information about support for version control in cPanel & WHM, read our Git Version Control and Guide to Git documentation.

Important:

  • This feature does not allow the following characters in repository paths:

`\ * | " ' < > & @ $ { } [ ] ( ) ; ? : = % #``

  • This function does not allow repositories that exist in the following

cPanel-controlled directories:

  • .cpanel
  • .htpasswds
  • .ssh
  • .trash
  • access-logs
  • cgi-bin
  • etc
  • logs
  • perl5
  • mail
  • spamassassin
  • ssl
  • tmp
  • var

Users can create repositories in some of these directories on the command line. They may appear in the list of repositories in Gitweb, but users may see an error message if they try to access them.

fieldsstringOptional
A comma-separated list of desired return values. Note: Use a wildcard (*) to list all possible return values.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

available_branchesarray<string>
A list of available local and remote branches for the cloned or existing repository. An empty array — No branches exist. null — The repository is a bare repository.
branchstring
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.
clone_urlsobject
An array of objects containing URLS to use to clone the repository.
read_onlyarray<string>
A list of clone URLs with read-only permissions. This function returns a blank array 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.
read_writearray<string>
A list of clone URLs with read-write permissions. This function returns a blank array 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.
deployableinteger
Whether the system could deploy the repository. 1 — Can deploy. 0 — Cannot deploy.
One of: 1 0
last_deploymentobject
An object containing information about the commit that the system most recently deployed. Note: The system only returns this object if deployment information exists.
deployment_dateinteger
The timestamp for the most-recent deployment.
repository_stateobject
A object containing information about the state of the repository at the time of the most recent deployment.
authorstring
The author's name and email address for the commit that the system most recently deployed.
dateinteger
The timestamp for the commit that the system most recently deployed.
identifierstring
The identifier (SHA-1 value) for the commit that the system most recently deployed.
messagestring
The commit message for the commit that the system most recently deployed.
last_updateobject
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.
authorstring
The most-recent commit's author's name and email address.
dateinteger
The timestamp for the most-recent commit.
identifierstring
The identifier (SHA-1 value) for the most-recent commit.
messagestring
The commit message.
namestring
The repository's display name.
repository_rootstring
The absolute directory path in the user's home directory containing the repository.
source_repositoryobject
An object containing information about the source repository. Note: The function only returns this object if you cloned a source repository.
remote_namestring
The source repository's name.
urlstring
The source repository's clone URL.
tasksarray<object>
An array of objects containing information about the Task Queue system's process that will clone the repository. Note: The function only returns this value if the clone process is not finished.
actionstring
The task's action. create — Create the repository. deploy — Deploy the repository.
One of: create deploy
argsobject
A list of arguments for the Task Queue system's process.
log_filestring
The absolute path to the process's log file. Note: The function only returns this value if the process generated a log file.
repository_rootstring
The absolute path to the repository's directory in the user's home directory.
idstring
The Task Queue system's task ID number.
sse_urlstring
The Secure Server Events (SSE) interface URL to track the progress of the process.
subsystemstring
The Task Queue subsystem that will handle the task. * VersionControl is the only possible value.
One of: VersionControl
typestring
The repository type. * git is the only possible value.
One of: git

update GET#

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.

repository_rootstringRequired
The absolute directory path that contains the repository to update.
branchstringOptional
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.
namestringOptional
The repository's new display name. If you do not specify a value, the function does not update this parameter.
source_repositorymixedOptional
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.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

available_branchesarray<string>
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.
branchstring
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.
clone_urlsobject
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.
read_onlyarray<string>
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.
read_writearray<string>
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.
deployableinteger
Whether the system could deploy the repository. 1 — Can deploy. 0 — Cannot deploy.
One of: 1 0
last_deploymentobject
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.
deployment_dateinteger
The timestamp for the most recent deployment.
repository_stateobject
A object containing information about the state of the repository at the time of the most recent deployment.
authorstring
The author's name and email address for the commit that the system most recently deployed.
dateinteger
The timestamp for the commit that the system most recently deployed.
identifierstring
The identifier (SHA-1 value) for the commit that the system most recently deployed.
messagestring
The commit message for the commit that the system most recently deployed.
last_updateobject
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.
authorstring
The most recent commit's author name and email address.
dateinteger
The timestamp for the most recent commit.
identifierstring
The identifier (SHA-1 value) for the most recent commit.
messagestring
The commit message.
namestring
The repository's display name.
repository_rootstring
The directory path that exists in the user's home directory containing the repository.
source_repositoryobject
An object containing information about the source repository. Note: The function only returns this object if you cloned a source repository.
remote_namestring
The source repository's name.
urlstring
The source repository's clone URL.
tasksarray<object>
An array of objects containing information about the Task Queue system's process that will clone the repository. Note: The function only returns this value if the clone process is not finished.
actionstring
The task's action. create — Create the repository. deploy — Deploy the repository.
One of: create deploy
argsobject
An object containing arguments for the Task Queue system's process.
log_filestring
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.
repository_rootstring
The repository's absolute directory path in the user's home directory.
idstring
The Task Queue system's task ID number.
subsystemstring
The Task Queue subsystem that will handle the task. VersionControl Note: VersionControl is the only possible value.
One of: VersionControl
typestring
The repository type. git — A Git repository. Note: git is the only possible value.
One of: git