How to Use Git Version Control to Upload Files on cPanel
Estimated reading time: 1 min
Using Git Version Control in cPanel allows you to deploy and manage your code efficiently. Follow these steps to upload files via Git:
Step 1: Log in to cPanel
Go to domain.com/cpanel and enter your credentials.
Step 2: Open Git Version Control
- Scroll down to the Files section and click on Git Version Control.
- Click Create to add a new repository.
Step 3: Clone or Create a Repository
- Option 1: Clone an Existing Repository
- Select Clone Repository.
- Enter the Git Repository URL (e.g., GitHub, GitLab, or Bitbucket).
- Choose the directory where you want to clone the repo.
- Click Create to complete the cloning process.
- Option 2: Create a New Repository
- Select Create New Repository.
- Choose a directory for the repository.
- Click Create to initialize a new repository.
Step 4: Upload and Push Files from Local to cPanel (If Not Cloned)
If you are working on your local computer, follow these steps:
- Initialize Git (if not done already)
- Add Remote Repository (If you created a repo in cPanel and need to push from local)
- Add and Commit Changes
- Push to cPanel Repository
If your branch is
master
, use:
Step 5: Deploy the Code in cPanel
- Go to cPanel > Git Version Control.
- Click on your repository.
- Click Manage > Pull or Deploy to fetch the latest updates from your Git repo.
Automating Deployment (Optional)
- Inside the Manage section of the repository in cPanel, you can set up an Automatic Deployment Script.
- This will automatically pull the latest updates when you push changes from your local machine.
Now, your files are uploaded and deployed using Git!