VersionControl
Repository Management
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.
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
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.
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
}
}