v1

latestOpenAPI 3.0.2cPanel License2026-08-06657427.1 MB
VersionControl
Repository Management

Create Git repository

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

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.

get/VersionControl/create

Query parameters

namestring required
Example:example

The new repository's display name.

repository_rootstring path required
Example:/home/user/public_html/example

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.
type'git' required
Example:git

The repository type.

  • git — A Git repository.

Note:

git is the only possible value.

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

HTTP Request was successful.

apiversioninteger

The version of the API.

funcstring

The name of the method called.

modulestring

The name of the module called.

Example response

{
  "apiversion": 3,
  "func": "create",
  "module": "VersionControl",
  "result": {
    "data": {
      "available_branches": [
        "master",
        "olive"
      ],
      "branch": "master",
      "clone_urls": {
        "read_only": [
          "https://user@example.com/home/user/example"
        ],
        "read_write": [
          "ssh://user@example.com/home/user/example"
        ]
      },
      "name": "example",
      "repository_root": "/home/user/public_html/example",
      "source_repository": {
        "remote_name": "remote",
        "url": "http://user@domain.com/home/user/domain"
      },
      "tasks": [
        {
          "action": "create",
          "args": {
            "log_file": "/home/username/.cpanel/logs/vc_1234567890.123456_git_deploy.log",
            "repository_root": "/home/user/example"
          },
          "id": "00000000/5a9ec8dd4c345d",
          "sse_url": "/sse/UserTasks/B3A27B96-51F7-11E8-92E3-CC90C4F823F0",
          "subsystem": "VersionControl"
        }
      ],
      "type": "git"
    },
    "status": 1
  }
}