How can I create a local repo on git on an external server?

In our company, we have really powerful Linux-based build servers (dual Xeon with 40 cores) and not very powerful win7 laptops. We are building our product in C / C ++ for an esoteric processor. The compiler exists only on Linux. I can edit the git repository using Qt Creator. It works pretty fast and all. But I can not create a source on our laptop. We have the main git repo, and I can clone the same repo on my laptop and on our build server. I want to achieve this when I click on the build button, my code is magically built on the build server. I made a proof of conceptual solution in which my build script executes git diff on my repo and outputs it to the build server than ssh to create a server using this diff on the repo server than starting and waiting for compilation. But this decision is not so flawless proof. I think there is a more suitable method / method. So how can I create a git repository on an external server?

+5
source share
3 answers

If you can click on a bare repo on the build server, then you can associate with this bare repo a post-receive hook ( .git/hooks/post-receive ), which will be:

  • check code

     #!/bin/sh git --work-tree=/var/www/domain.com --git-dir=/var/repo/site.git checkout -f 
  • starts compilation.

This way you don't have to deal with the difference. You just need to associate an action with the build button to direct your branch to the bare repo of the build server, and the rest of the post-receive command will do the rest.

+4
source

You can switch to forking Workflow , where every developer in the company has a public public repo, which is the fork of the official central repository.

Then, when you want to create your changes, you push them (branch or master) to your personal public repo.

The build server not only clones the official central repository, but also your public repo. Therefore, when you click on your personal public repo, the build server merges the changes and makes a personal build for you. Just as this is probably already being done for the official central repository?

Note that this is not too different from @VonC's answer, it just focuses a bit more on the workflow. A personal public repo could very well be on the build server, as @VonC suggests. Or it could be somewhere else. Until this is a simple enough place so that the build server and you and your colleagues can find it.

+2
source

Consider integrating http://jenkins-ci.org/ into your workflow to take care of the build process by using the "git post-receive hook" to start the build as (suggested by @VonC).

If you want to use the β€œWorkflow for Forks” as @flup suggests, you can take a look at http://gitlab.com , which provides an easy way to manage pull / merge requests, fork stores, and adding hooks.

+2
source

Source: https://habr.com/ru/post/1215256/


All Articles