(suppose) I have my own git, so you can do
git clone https://official.example.org/myproject.git
But, at my server official.example.org
I want to redirect it to Github. How to do it at UBUNTU 16LTS standard git-server? It is an usual web-server redirect (eg. Apache) or need special preparation?
PS: the technology exist, as announced here.
You can change a Git remote URL using the git remote set-url command. Navigate to the repository whose remote URL you want to change and then execute this command. The set-url command accepts two arguments: the remote name and the new repository URL. Have you changed the name of a remote Git repository?
The redirect is accomplished with a <meta> tag. By setting the http-equiv attribute to refresh and the content attribute to 0; URL=https://example.com/ we will redirect the user to 'https://example.com/'.
I use the git post-receive hook in my buildfarm to automatically build projects in Jenkins when code is pushed to my git repository. You could do something similar with some of the other git hooks on your server to push code to github.
Similarly, on github you could define a webhook to update your git repository on official.example.org whenever code in the github repository is updated. Something like this answer maybe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With