GitHub Actions: How to let a local server pull the change automatically from remote branch - github

I have the followings.
Apache server hosted on centos
GitHub (GitHub Actions)
An web app hosted on the local apache server.
Every time I make a change to a local branch and push to remote master branch in GitHub, I have to ssh into the apache server and run git pull origin master. What is the best way and how to set up an automatic pull/deployment on the local server so that it will listen and pull the change automatically?
I have read about GitHub Actions self-hosted runner and ssh solution. but I am not sure how to achieve this in the most efficient way.

You can use GitHub actions to do this by specifically using the action SFTP-Deploy which essentially copies your code from your GitHub repo and places it in your apache server directory.

Related

Why does adding a repository in GitHub Desktop locally not show my pull requests

So I have a GitHub Enterprise account. On GitHub Desktop when I clone my repository from the server it goes under Enterprise and I can see the list of branches and Pull requests as shown below.
If I simply add an existing repository from my local machine onto GitHub Desktop, then it goes under Other and now I can't see the option for showing me my pull requests.
I don't want to have to reclone all my repo because that just seems silly but is there a way I can still see if there's any pull request from my repo that I simply added in from my local machine?

Copy the entire master branch from one GitHub enterprise server to another GitHub enterprise server in a different location

We have two hosted GitHub enterprise servers on VMWare servers in a distinct location. We would like to copy all master branch from one GitHub enterprise server to another GHE (maybe every day once). Also, we need to configure alerts to notify in case of copy failure, network issues, etc.
Could you please help me to implement this?
git clone --bare https://github-dev.assr.com/assr-ghactions/setup-java.git
git push --mirror https://github-qa.assr.com/assr-ghactions/setup-java.git

How to update local repository using GitLab UI?

I was looking to update my local repository using GitLab UI. Is this possible without using the command line or any other client application such as GitHUB desktop.
Thanks
GitLab UI represents first your remote repos, as hosting by the remote Git repositories hosting servers.
It can show you the git command to execute in order to clone your Git repository, but you would still need to use that URL in a local tool or CLI, like git clone /url/gitlab/repo.

How do I mirror Github page for local browsing?

Let's say I have an internal web server (nginx) and I want it to serve a page with the content of the GITHUB repository, e.g. https://github.com/vibranze/test. Page from the repository must be served locally.
I've tried the article from https://help.github.com/articles/duplicating-a-repository/ but the synced repository is not browseable due to no index file.
How do I make the local repo browseable internally and looks exactly the same like what its master copy in github.com or if I've done it wrongly, what's the correct way to achieve it?
Any pointer or advice are greatly appreciated.
Thank you.
Short answer:
You need a local Git server which hosts a clone of your example repository from GitHub.
If your local Git server includes a web UI, you can probably see something similar like what you see on GitHub.
If you want future changes in the GitHub repo in your local repo as well, you need to pull periodically from the GitHub repo to your local repo.
Long version:
1. Hosting Git repos on your local server
There are a lot of options (paid and free) for running a Git server on your own machine.
Some of them contain web UIs which look similar (but not exactly the same) like GitHub.
There's only one option to get 100% the same look: by spending money for a private installation of GitHub (but it's not cheap).
If you don't want to spend that much, there are free alternatives, for example GitLab. This is a hosted service like GitHub, but the code is open source and you can install a free version on your local server.
Here's an example of a "repository overview" page:
https://gitlab.com/gitlab-org/gitlab-shell
GitLab is only one example, there's a lot more - just google for "self hosted git" and you will find plenty.
2. Getting a clone of the repository from GitHub to your local server
To set this up, clone the repo from Github to your local machine once with the --mirror option:
git clone --mirror https://github.com/user/repo some/local/path
To update your local repo with the newest changes from GitHub, you need to run git remote update periodically.

Connect many Jenkins servers with different branches of the same github repo

I want to set up a staging server where each developer will have his own docker container running the app and Jenkins .
I want each one to be able to connect his github branch with his jenkins server with the github plugin for jenkins and create the automated build pipeline. But every branch will be in the same corporate private repository.
Push code from IDE -> Code goes on Github -> Github pushes to jenkins(in container) -> jenkins builds new code(in container) -> tester connects to container and browses the app branch
I have made 2 containers each with a jenkins server. One is connected with master branch and the other with branch1 of the same repo. But each repo allows only one implementation of the github plugin for jenkins.
Setting one new repo for every branch seems kind of silly and wasteful.
Best case scenario would be to connect many jenkins servers with the same repo but on different ports by specifying different branches.
Is something like this possible?
If those docker container can mount the same data container with the git repo in it, that means they can checkout different branches per repo.
For that, they need a recent git (2.5+) and to use the new git worktree add command.
Then those containers would work in a worktree set to a different branch per container, but all pointing to the same repo.