Git server - auto (re)push - linux

We have own linux server, with a git server. But for some reasons we create bitbucket account (private repos) and now we want use it as "backup".
Now i want set when someone push code on own server -> server make other push on bitbucket.
It is possible? Has someone script for this or some idea .....?

I believe you can do this via git post-receive hook.

Related

How to push changes from GitHub Desktop to Cpanel

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

Git on server with no SSH access

I have copied all of the files from my production server into a local repo. I want to set up Git on the production server (Linux) so that when I push changes, they are automatically synchronized with the server.
Unfortunately, our hosting service does not allow us SSH access. Is it possible to install and set up Git on the server without having SSH access? (I can run commands in a php script using shell_exec() as kind of a workaround).
Here are some close threads with popular answers:
How to make a “git push” update files on your web host?
Pushing from GitHub to a Web Server
Private git repository over http
You could use http, https or git protocol instead of ssh. More information you can find here

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

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