How to push changes from GitHub Desktop to Cpanel - linux

Is it possible to directly push changes to a cpanel repository from GitHub desktop software. Or first the repository changes will be pushed to the online repository on github.com and then from there the cpanel will fetch the changes by clicking Update from Remote & Deploy HEAD Commit

One possibility would be to use a GitHub Action, that is a process able to run on GitHub side, triggered by a push.
For example, a deployment action, like one to publish to Netlify or zem
You would need to adapt such an action to push/publish to Cpanel, using an API key.

Clone the remote repository on your cPanel account to your local computer. git clone URL
Create the .cpanel.yml file.
Add the cPanel-managed repository as a remote. git remote add origin URL
Push changes to the cPanel-managed repository. git push -u origin HEAD
For more information: https://documentation.cpanel.net/display/CKB/Guide+to+Git+-+How+to+Set+Up+Deployment

Related

How do i add and sync my local git on server? What is bare repo?

I am using git from a long time but never set it up on server. Refereeing to this Git: move existing repository from PC to server, clone from server
I have initiate a bare repo on server but while adding origin in local
"git remote add origin server:path/to/repo" i have no idea what to add here. My site is getwalkwel.com and user is getwamld
Thanks
Origin is the name of a remote which is typically created automatically when you clone a repo from another repo. The origin reference in the cloned repo will be created to point back to the repo that was cloned from.
In your case, where the bare repo was actually created later from your working repo, you will create origin in your working repo to point back to your new bare repo.
This is done with:
git remote add origin /barerepo/fullname
If your bare repo is going to line on a different machine, then you need the URL to reach the repo instead of just a file path.
For instance, you might have myuser#myserver:path/to/repo
Bare repository in Git is a repository which only contains version control information only in fact this will not have .git sub-directory or any working files.
This kind of repository is helpful when you need to share or divide your work between few people for example in work environment you and your team mates are working on same project and you all need to see changes and all needs to do push to repository in this case this repository is more useful.
You can add the remote repository to local git repo
$ git remote add origin ssh://myserver.com/var/git/myapp.git
pushing to remote repository:
to push our local master branch to the origin's master branch. You can do that using the git push <target> <local> command.
$ git push origin master
click here for more information on how this works

Gitolite update copy at server when push

In gitolite I've set up a new repository on the server and able to clone it from my machine.
As it's a web project I need the latest working copy at /var/www/my-project, so every push made by a developer will update the files there. How can I achieve that?
thanks
The repos managed by gitolite are managed in ~/repositories
You can add your own hook in ~/repositories/yourrepo.git/hooks called post-receive hook in order to checkout, on each push, the index to a working tree of your choice (like
/var/www/my-project)
See for instance "how to process files on a branch in post-receive hook in git" (which can even check for which branch is pushed).
The checkout uses:
git checkout --work-tree=/var/www/my-project

How does Git know which repository to push to?

I'm a complete noob when it comes to version control, but I recently started using GitHub to host some of my projects. I blindly use the command git push origin master to push changes to either of the two repositories. I don't understand how Git knows which repository to push to. I use the same command to push to each. Does the directory I'm in have anything to do with it?
Thanks for clearing this up for me.
A word of advice, "blindly use"ing anything is a bad idea.
git has a system of remotes which allows to specify URLs and transports to repositories other than the one where you're working. git push origin master pushes the current branch to the remote called origin as the branch master. You have a remote called origin. This is created by default when you clone a repository from a URL.
git remote add origin http://abc.com/def/ghi.git tells git the url that remote 'origin' points to.
When you use git push origin master, you aren't pushing to two repositories - you are pushing to the master branch in your repository who's name (alias) is origin.
Think of it like this:
I'm pushing my stuff to origin which is my repository address. What am I pushing there? My master branch.
If you are new and set git up yourself through git init, you probably aren't pushing to two repositories. Run this command to see what your remotes are:
git remote -v
This will return something like (assuming you have a git hosting service like github):
blahblah git#github.com:yourGithubName/fileName.git (fetch)
blahblah git#github.com:yourGithubName/fileName.git (push)
git#github.com:yourGithubName/fileName.git is your repository address. Some addresses are prefixed by https:// .
Git repositories contain a .git directory that contains metadata about the repository. That's what Git uses to determine where to push your changes.

git server and client set up in linux

i am new to git and now i am trying to set up a git server and want to access the server from client.
referred many links but those are not helping me. i tried with the link http://davedevelopment.co.uk/2010/12/05/how-to-install-gitolite-on-ubuntu-10-10-maverick-meerkat.html. after the final step in the document i didn't know how to proceed.
can anyone give the details?
thanks in advance.
if you have cloned a repository on your client you are ready to start coding...
git commit
to commit changes locally, and
git push
to push your changes to the server.
What is missing on the above answers is how to push on the server a new repo.
Suppose that in the gitolite config file you have a repo named my_repo, you can add to the server an existing local repo this way:
cd my_repo
git remote add gitolite git#your.git.server:my_repo
git push gitolite master
You have to type ONLY ONCE the second line above. After that, you only have to push.

How to upload a git repo to gerrit?

I installed the gerrit service on a ubuntu server,and my PC as client.
I created a git repo on my PC(with msysgit),and the question is :how can I upload the git repo to the Ubuntu server?Should I do some work on Ubuntu server first(i just installed gerrit and git service )?
First, you need to create the project on the Gerrit server using gerrit create-project.
Next, edit the project permissions if necessary to add the following for your user (Administrators group, probably):
Create reference
Forge committer identity
Forge author identity
This allows you to upload an existing history, perhaps committed by different people, bypassing the need to review every commit you select.
Finally, push your code:
git remote add gerrit gerritserver:project
git push gerrit master:refs/heads/master

Resources