In CyberPanel v2.0.0, we introduced the Git Manager. Git Manager is a powerful and feature-rich tool within CyberPanel which many don’t know about. Using this feature you can automate your application deployment directly from your Git repositories. CyberPanel can automatically pull new changes with the help of webhooks. You can also automatically push new changes to your repository.
You can initiate/attach repositories to various folders or virtually any folder inside your website. Being a developer, this feature holds great value as we personally use it for our development lifecycle.
If you are a developer you must know about git and GitHub, but if you don’t, read on. GitHub is a code hosting and development platform. GitHub is basically used for code collaboration, usually by open-source projects, however much major commercial software like Windows uses the same too. The main and important thing about GitHub is its basic version is free, and in 2019 GitHub allowed developers to create unlimited private repositories on GitHub. But they added a limit on the collaboration on the free plan.
GitHub has millions of users and day by day its use is increasing. GitHub allows developers to work as a team remotely and has a lot of features.
Some statics about GitHub:
The repository is basically the data of your project. The repository contains files and data of your project that you are working on. In the repository, your project files reside with detailed history of when they were edited and by whom.
GitHub offers you two types of repositories: Private and Public. Now in GitHub, you can create unlimited free repositories. On GitHub, you can share access to your repo with others and manage the ownership.
GitHub allows you to collaborate and make a team with developers around the world and work with them. You can get feedback and solve the issues with different responses.
In CyberPanel v2.0.0 we introduced the Git Manager feature. Although this is a very rich and advanced feature, a lot of CyberPanel users do not know about this feature. If you are a developer and you are using CyberPanel as your web hosting panel you must know about this feature of CyberPanel.
CyberPanel Git Manager allows you a lot of benefits like:
To access the Git Manager feature on CyberPanel. You have to log in to CyberPanel using credentials. CyberPanel must be Upgraded to v2.0.0 or above. If you have an older version follow this guide to upgrade.
Once logged in, go to Website-> List Websites, and select the website for which you want to use Git Manger. Then click on the Manage button on the screen.
On the Manage Dashboard on the top right, you can find the Manage GIT option to open Git Manager for that specific website.
You can see the Git Manager screen here now.
CyberPanel Git Manager allows you to track different types of data to GitHub.
CyberPanel allows you to perform two types of functions for the repository.
Both will be discussed later in this post.
If you are initiating a local repository you don’t need to do this step. But, if you are attaching an existing remote repository you need to add your key to GitHub/GitLab etc.
To add your key to GitHub (usually the process is same with GitLab) follow the procedure below:
Click on the Attach Existing Repo button present on the Git Manager screen.
Press this button and you can see a screen that asks you to provide some details and connect your GitHub to CyberPanel Git Manager.
Below all these, you can see a key. You need to copy this key and follow the steps mentioned below.
You need to log in to gihub.com and then go to Profile button->Settings->SSH keys and GPG keys.
Here you can see an add button to add the ssh key you got from the CyberPanel Git Manager from the last step. Press Add SSH Key and then copy that key, paste here, and then click Save.
After adding this, press Add SSH key. You will see it saved there.
Once the key is added we can go back to CyberPanel Git Manager.
Press the Save button on the screen from where you copied the key, and it will show you a successful message.
In CyberPanel Git Manager you can also initiate a git repository locally using this feature. CyberPanel Git Manager allows you to entirely create a new repo and push it on GitHub servers. There is a lot to do in CyberPanel Git Manager Init Repo feature. Follow along and check out what you can do.
NOTE: Once you are able to reach the Git Manager dashboard and you see the Init repo button, if you are logged in you can follow this URL too:
Press the Init Repo button and go to the next screen. It will look like this:
Here you can see you can perform a lot of Git tasks. No need to run the commands manually. Just check the button and perform the task you want to do. All details about these are mentioned below.
The first option in Git Manager you can see is the configure. Here on this option, you can do some configurations.
You can create and maintain different Git branches directly within the Git Manager. Just press the Create New Branch option in Git Manager and create a new branch. Write the name of the new branch and press the save button.
On GitHub, there may be only one person or a team of developers working on the same project. When anyone pushes their work to the repository, they add a commit. This commit helps in version control and allows you to know to what anyone did at that time. Just press the Commit button from Git Manager and add the commit you want.
In GitHub, there are two main things you have to take care of: the push and pull requests.
Pull requests are one of the most important operations when you are working with collaborations. It means when you make any changes you ask others to pull your changes into their branches. Pull requests show the difference between both branches, Like green and red.
As soon as you commit anything after that you can open a pull request and ask for discussion.
CyberPanel Git Manager provides you a button on the dashboard to do this easily.
Attach your GitHub repo using the above method and pull any branch you want to pull.
When you want to upload your local repository to the GitHub remote server you use the git push command. Pushing is how you transfer commits from your local repository to a remote repo.
This is also one of the core functions of GitHub. You can push your repo to the remote server after committing something. CyberPanel Git Manager also allows you to do this by using the Push button on the Git Manager dashboard. You can push any of your local repos to remote from GitHub server, and any branch.
CyberPanel Git Manager also allows you to edit the git ignore file. You can update the gitignore file and can add anything you want to add or remove from that file, to exclude from pushing to the GitHub remote server.
You can also see git logs from the CyberPanel Git Manager. Just press the git button and see what you did in the logs.
If you want to remove the current working git from this project just press the remove button and all done.
As mentioned above, this option is to integrate the Local git repo with the GitHub remote repository.
If you want to see what you committed on this repo you can press the View commit button and see all commits you added to this project.
Attach Existing Repo allows you to push your data to the repo that already exists. You can send your data to any repo at your remote GitHub which is already present there.