title | excerpt | updated |
---|---|---|
Configuring and using Git with an OVHcloud web hosting plan |
Find out how to configure and use Git with your web hosting plan in the OVHcloud Control Panel |
2025-01-31 |
In today’s digital landscape, companies are becoming increasingly dynamic and innovative. The ability to effectively manage and deploy your website’s code is vital to maintaining your brand’s competitiveness and sustainability. Git, the most widely used version control system in the world, allows you to store your website's code on platforms like GitHub, allowing for better change traceability, as well as faster automation and deployments. As an OVHcloud customer, you benefit from a robust infrastructure to host your website, while leveraging the many benefits of Git and GitHub for website development and scalability.
Find out how to configure and use Git with your web hosting plan via the OVHcloud Control Panel.
- An OVHcloud Web Hosting plan.
- Access to the OVHcloud Control Panel, in the Web Cloud section.
- A GitHub{.external} account on which you must be logged in.
[!primary]
To date, only the GitHub platform is supported for use with OVHcloud Web Hosting services.
[!primary]
To associate and configure Git, you will need to make changes to your GitHub account. Before starting the guide, log in to your GitHub account.
Warning
When you associate a directory with Git, all domain names in that directory will also be associated with Git. For example, if the directory corresponding to the website you are associating with is www
, then all domain names associated with the www
directory will also be associated with Git.
Log in to your OVHcloud Control Panel and perform the following actions:
- Go to the
Web Cloud
{.action} tab. - Select your web hosting plan in the
Hosting plans
{.action} section on the left. - Click on the
Multisite
{.action} tab. - In the table that appears, identify the row corresponding to the directory you want to associate with Git.
- Click on the button
...
{.action} then selectLink Git
{.action}.
The Git association form is displayed. There are several elements that need to be configured:
- GitHub repository
- GitHub repository branch
- SSH key (for a private GitHub repository)
- Webhook (optional)
Enter the address of your GitHub repository. If you don't have a GitHub repository for your project yet, create one.
To create a new repository:
- Log in to your GitHub account.
- Click on your profile picture in the top right-hand corner, then on
Your repositories
{.action}. - On the right of the screen that appears, click
New
{.action}.
Define a name for your deposit and fill in the requested information.
Warning
Tick the option Add a README file
for GitHub to correctly initialise your repository.
Finally, click Create Repository
{.action}.
Copy the address of your GitHub repository. It must be of the form:
https://github.com/<username>/<repository_name.git>
for a public repository.[email protected]:<username>/<repository_name.git>
for a private repository.
Return to the Git association form and paste the address of your GitHub repository into the Deposit
{.action} field. If the address format is not correct, the following error message appears:
Now define the branch of your GitHub repository. The default branch is main
, but if you want to use another branch, create one on GitHub by following the steps below:
- Log in to your GitHub account.
- Click on your profile picture in the top right-hand corner, then on
Your repositories
{.action}. - Go to the relevant GitHub repository.
- Click
Main
{.action}, thenView all branches
{.action}, or directly clickx Branch
{.action}. - To the right of the screen that appears, click
New branch
{.action}. - Enter the name of the new branch and confirm by clicking
Create new branch
{.action}.
Go back to the Git association form in the OVHcloud Control Panel, and enter the name of the new branch you have just created.
[!primary]
Generating an SSH key is a crucial step, as it establishes a secure and encrypted connection between your website’s directory and the GitHub repository. This key ensures that data transfers and code changes are done in a secure and authenticated manner, preventing unauthorized access and ensuring code integrity.
[!primary]
Why is the SSH key required only for a private deposit?
When your GitHub repository is public, files can be retrieved without authentication, which means Git can clone and update code without the need for an SSH key. However, if your repository is private, GitHub requires authentication to access it. The SSH key can then be used to establish this secure connection and guarantee that only authorized users can interact with the repository.
Copy and save the SSH key to your GitHub account. This way, you can establish a secure connection without having to enter a password each time you perform a Git operation.
- Log in to your GitHub account.
- Click on your profile picture in the top right-hand corner, then on
Settings
{.action}. - On the new page, click
SSH and GPG keys
{.action} in the left-hand column. - Select
New SSH key
{.action} orAdd SSH key
{.action}.
The form for adding a new SSH key will open:
- Title : add a description for your SSH key. For example, you can name this key "OVHcloud".
- Type of key: leave the default value
authentication key
- Key: Paste your SSH key.
To confirm the information, click Add SSH key
{.action}. If prompted, confirm access to your account in GitHub.
At the bottom of the Git association form, a Configuring automatic deployment
{.action} section will appear, along with the webhook URL. By configuring a webhook, your GitHub repository can automatically notify your OVHcloud web hosting plan of events that occur on the GitHub repository (new deployment, changes in code, etc.). This feature is especially useful if you work as a group on the same project and want to stay up to date with all changes in the GitHub repository. To learn more, learn how to configure a webhook on GitHub.
Before validating the Git association form, make sure that:
- Your SSH key has been saved in your GitHub account.
- The address of your GitHub repository is correct. It must be of the form
https://github.com/<username>/<repository_name.git>
. - The name of the GitHub repository branch is correct.
- Your installation directory is empty.
To validate the information in the Git association form, click Apply configuration
{.action}.
After validating the Git association form, you are redirected to the Multisite tab.
A green banner will show you that Git is being enabled. Follow the activation of Git by clicking on the Current tasks
{.action} link.
The status Running
{.action} indicates that the Git association is in progress. The process may take several minutes. When the task is complete, the status Enabled
{.action} is displayed.
You can also track the progress of Git activation from the Multisite
{.action} tab. In the table, identify the rows that correspond to the directory you want to associate with Git. For each of the rows concerned, in the Git
{.action} column, the phrase In progress
{.action} tells you that Git is being enabled.
When the Git association is complete, the status Enabled
{.action} appears in the Git
{.action} column for the rows concerned.
In the table in the Multisite
{.action} tab, identify the rows corresponding to the directory you want to associate with Git. In the Git
column, if the word Error
appears, this means that at least one of the following errors has occurred:
- The SSH key has not been saved in your GitHub account.
- The installation directory is not empty.
- The GitHub repository address does not exist or is incorrect.
- The branch of the GitHub repository does not exist or its name is incorrect.
For the exact cause of the error, see the information from the last deployment. In the table, identify the row corresponding to the domain name for which you want to view the logs for the last deployment. To the right of the line, click on the ...
{.action} button, then on Latest deployment information
{.action}.
Once you have identified the error(s), associate Git again. Retry the operation by clicking on the ...
{.action} button on the corresponding line, then on Link Git
{.action}.
Log in to your OVHcloud Control Panel, go to the Web Cloud
{.action} section, click Hosting plans
{.action}, then choose the name of the web hosting plan concerned. Select the Multisite
{.action} tab. In the table that appears, identify the row for the domain name that you want to deploy with Git. Ensure that the status of the Git column is Enabled
{.action}. Click the ...
{.action} button, then Deploy Git
{.action}.
A confirmation message appears, along with a check box telling you that if there is a conflict during deployment, you can force remote (GitHub repository) changes on your local repository. Tick or untick the box depending on your choice, then click Confirm
{.action} to validate the deployment.
Warning
To avoid losing your local changes, remember to save them before overwriting them with changes from the remote branch.
The new version of your website has been deployed on your OVHcloud hosting plan. If other people are working on the same project and they make changes on the GitHub repository, then you can configure a webhook on GitHub so that their changes are automatically deployed to your web hosting plan. This avoids having to deploy Git manually, and your web hosting plan will always be up-to-date.
Log in to your OVHcloud Control Panel, go to the Web Cloud
{.action} section, click Hosting plans
{.action}, then choose the name of the web hosting plan concerned. Select the Multisite
{.action} tab. In the table that appears, identify the row for the domain you want to modify. Click the ...
{.action} button, then Modify domain
{.action}. There are two possible scenarios:
The following window appears:
Modify the information of your choice and click Next
{.action}.
A second confirmation window will appear, with a summary of your changes.
Click Confirm
{.action} to confirm your domain name changes.
The following window appears:
As the message states, delete your Git association first before changing your domain name.
Log in to your OVHcloud Control Panel, go to the Web Cloud
{.action} section, click Hosting plans
{.action}, then choose the name of the web hosting plan concerned. Select the Multisite
{.action} tab. In the table that appears, identify the line corresponding to the domain that you want to detach from your OVHcloud web hosting plan. Click the ...
{.action} button, then Detach domain
{.action}. There are two possible scenarios:
The following window will appear.
Click Confirm
{.action} to confirm the detachment of your domain name.
The following window appears:
As the message states, delete your Git association first before detaching your domain name.
Log in to your OVHcloud Control Panel, go to the Web Cloud
{.action} section, click Hosting plans
{.action}, then choose the name of the web hosting plan concerned. Select the Multisite
{.action} tab. In the table that appears, identify the row corresponding to the directory you want to configure with Git. Click the ...
{.action} button, then Configure Git
{.action}.
The following information is displayed:
- SSH key: If you have not already done so, save your SSH key in your GitHub account.
- Deposit: Address of your Git deposit. This field is grayed out because you cannot change the address of the Git repository. To change the Git repository URL, you must remove Git association from your directory and then associate directory to Git again.
- Branch: Name of the branch of the GitHub repository. You can edit this field.
- Webhook URL: If you want to optimise your deployments on Git, configure the webhook on GitHub.
Once you have deployed your GitHub repository on your web hosting plan, you can view information on the latest deployment, such as errors, tests and any useful information.
Log in to your OVHcloud Control Panel, go to the Web Cloud
{.action} section, click Hosting plans
{.action}, then choose the name of the web hosting plan concerned. Select the Multisite
{.action} tab. In the table that appears, identify the row for the domain whose logs you want to view from the last deployment. To the right of the line, click the ...
{.action} button, then Latest deployment information
{.action}.
On this screen, you can view all the information related to the latest deployment.
Log in to your OVHcloud Control Panel, go to the Web Cloud
{.action} section, click Hosting plans
{.action}, then choose the name of the web hosting plan concerned. Select the Multisite
{.action} tab. In the table that opens, identify the row corresponding to the directory whose association with Git you want to remove. Click the ...
{.action} button, then Delete Git
{.action}.
The following window appears:
The message informs you that the deletion will apply to all domain names attached to your directory. Tick the Do you want to empty the contents of the <your_directory> directory?
{.action} option if you also want to delete the contents (folders and files) of the directory.
1. If you select the check box, the following window appears:
Click Confirm
{.action} to confirm the deletion of the Git association from your directory, as well as its contents.
2. If you do not select the check box, the following window appears:
Click Confirm
{.action} to confirm the deletion of the Git association from your directory.
[!primary]
If you are already in the Git association form, copy the webhook URL and go to the step “Configure the webhook”.
Log in to your OVHcloud Control Panel, go to the Web Cloud
{.action} section, click Hosting plans
{.action}, then choose the name of the web hosting plan concerned. Select the Multisite
{.action} tab. In the table that opens, identify the row that corresponds to the directory where you want to configure a webhook. Click the ...
{.action} button, then Configure Git
{.action}.
At the bottom of the form that opens, identify the address of the Webhook URL
{.action} field, and copy it. You will now need to save the URL and configure the webhook on your GitHub account.
Log in to your GitHub account, and go to the repository where you want to configure the webhook. Go to the Settings
{.action} tab, then in the settings side menu, click Webhooks
{.action}. Click the Add webhook
{.action} button to access the form:
- Payload URL: Enter the URL provided in the Git association form (
Webhook URL
{.action}). - Content type: Choose
application/json
{.action} as the content type for the data sent. - Secret: The secret is optional. GitHub will use it to sign messages sent by the webhook, enhancing security.
- SSL verification: If your website supports HTTPS, leave this option enabled for increased security.
- Which events would you like to trigger this webhook?: Select the events that will trigger the webhook to be sent. For automatic deployment,
Just the push event
{.action} is often enough, but you can chooseSend me everything
{.action} to receive notifications for all events. - Active: Make sure that the box is ticked to enable the webhook.
Click Add webhook
{.action} to save and activate your new webhook.
Once you have created your webhook in GitHub, go to the list of your webhooks and select the one you have just created, or click Edit
{.action}.
On the screen that appears, click on the Recent Deliveries
{.action} tab. To send a test event specifically, GitHub usually sends a ping
event when creating the webhook, and you can use the Redeliver
{.action} button next to this event to test it.
If the test has worked, the Response
{.action} tab returns a code of 200. If an error code is returned (usually 500 or 400), this means that your webhook has been misconfigured. Return to the form for adding a webhook, and check the information, specifically the webhook URL provided by OVHcloud.
Once your webhook has been set up, your website’s code will be updated automatically whenever changes occur on the GitHub repository. For example, if changes are made by one of your colleagues on the GitHub repository, then your website code will be updated locally (on your OVHcloud hosting plan).
You have just linked your website code with Git, via your GitHub repository. You can now deploy the changes made on the GitHub repository to your web hosting plan, or deploy them in an automated way using the webhook. You can also view your deployment logs and perform multiple actions in just a few clicks via the OVHcloud Control Panel.
Putting a website online on your web hosting plan
For specialised services (SEO, development, etc.), contact OVHcloud partners.
If you would like assistance using and configuring your OVHcloud solutions, please refer to our support offers.
Join our community of users.