Skip to content
Your Hosting Ad Goes Here KBAssets

How to Set Up Your First Git Repository in cPanel

Creating a Git repository in cPanel is a straightforward way to manage your project’s code directly from your hosting environment. Whether you’re building a new website or deploying an application, cPanel’s Git™ Version Control makes it easy to set up and manage repositories without needing advanced command-line knowledge.


Step-by-Step Guide to Setting Up a Git Repository in cPanel

Step 1: Log in to Your cPanel Dashboard

  • Access your cPanel account by entering your credentials.
  • Once logged in, navigate to the cPanel Dashboard.

Step 2: Open Git™ Version Control

  • Locate the Git™ Version Control option in the Files section of your cPanel dashboard.
  • Click on it to open the Git management interface.

Step 3: Create a New Repository

  • Click on the Create button at the top of the Git™ Version Control interface.

Step 4: Configure Repository Options

1. Clone a Repository (Optional)

  • Toggle the Clone a Repository option on if you want to pull an existing repository from a remote location (e.g., GitHub, Bitbucket).
  • Clone URL: Enter the repository URL. Supported formats include:
    • https://example.com/repository.git
    • ssh://[email protected]/repository.git
    • git://example.com/repository.git

2. Repository Path

  • Enter the desired path for the repository in the Repository Path field. Example:
    /home/username/my-repository
  • If the path doesn’t exist, cPanel will automatically create the directory.
  • Ensure the path:
    • Is relative to your home directory.
    • Does not include invalid characters like ./, ../, whitespace, or symbols (\ * | " ' < > & @ $ { } [ ] ( ) ; ? : = % #)

3. Repository Name

  • Enter a descriptive name in the Repository Name field (e.g., MyWebsiteRepo). This name is only for display purposes and won’t affect functionality.
  • Avoid using special characters like < and >.

Step 5: Finalize and Create the Repository

  • After filling in all required fields, click the Create button to complete the setup.
  • If you selected Clone a Repository, the system will clone the remote repository to the specified path.

Step 6: Access Your Repository

  • Once created, the repository will appear in the Git™ Version Control interface.
  • For a new repository, you can now initialize it locally and start adding files:
git init
git remote add origin ssh://[email protected]/home/username/my-repository.git
git add .
git commit -m "Initial commit"
git push -u origin master

Conclusion

You’ve successfully created your first Git repository in cPanel! Whether you’re starting from scratch or cloning a remote repository, the Git™ Version Control interface simplifies version control and deployment for your projects. You can now start tracking changes, collaborating, and automating deployments directly from your hosting environment.


Was this article helpful?
YesNo
Back To Top