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

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

Related

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.

Migrate repository from GitHub Enterprise to GitHub [duplicate]

We have a few repositories and forks on a trial version of Github Enterprise. I want to evaluate how to migrate from Github enterprise to Github.com (into a paid for organization, say)
The only resource I found was how to perform the migration in the opposite direction
https://help.github.com/enterprise/2.0/admin/articles/moving-a-repository-from-github-com-to-github-enterprise/
I have contacted github.com asking the same questions as below and I am waiting for their response.
How do we migrate a repository from github Enterprise to github.com? (fairly certain that a git clone --bare and a git push --mirror will do the job)
If I migrate forks as well, how do we make sure that the relationship between the original and forks is maintained?
How do I migrate the webhooks and services we configured for our repositories?
How do I transfer the Pull requests/Issues? (article I linked to above says we need to use the Github API, I am OK with this solution)
Can we migrate teams and users? (guessing, probably not)
Note that we have the backups of the enterprise instance performed using the backup tools provided by github (I think it is called ghe-backup)
Thanks
You should be able to use the steps in the linked document in the reverse order as well:
Create an empty repository at github.com
Create a clone of the enterprise repository on your local.
Add github.com as a remote reference on your local clone.
Push all references to the github.com repository.
http://www.alexhadik.com/blog/2016/5/26/migrating-github-repositories-with-gitmover appears to offer a solution: GitMover is "a simple Python script that takes Git repos on any type of GitHub installation, and copies issues, labels and milestones from one to the other. It's the perfect tool to help automate the open-sourcing of an internal project."

Migrate from github enterprise to github.com

We have a few repositories and forks on a trial version of Github Enterprise. I want to evaluate how to migrate from Github enterprise to Github.com (into a paid for organization, say)
The only resource I found was how to perform the migration in the opposite direction
https://help.github.com/enterprise/2.0/admin/articles/moving-a-repository-from-github-com-to-github-enterprise/
I have contacted github.com asking the same questions as below and I am waiting for their response.
How do we migrate a repository from github Enterprise to github.com? (fairly certain that a git clone --bare and a git push --mirror will do the job)
If I migrate forks as well, how do we make sure that the relationship between the original and forks is maintained?
How do I migrate the webhooks and services we configured for our repositories?
How do I transfer the Pull requests/Issues? (article I linked to above says we need to use the Github API, I am OK with this solution)
Can we migrate teams and users? (guessing, probably not)
Note that we have the backups of the enterprise instance performed using the backup tools provided by github (I think it is called ghe-backup)
Thanks
You should be able to use the steps in the linked document in the reverse order as well:
Create an empty repository at github.com
Create a clone of the enterprise repository on your local.
Add github.com as a remote reference on your local clone.
Push all references to the github.com repository.
http://www.alexhadik.com/blog/2016/5/26/migrating-github-repositories-with-gitmover appears to offer a solution: GitMover is "a simple Python script that takes Git repos on any type of GitHub installation, and copies issues, labels and milestones from one to the other. It's the perfect tool to help automate the open-sourcing of an internal project."

How can I configure git on a server with a development and production branch?

I am absolutely new to git. I'm the sole developer on a fairly large project and want to start keeping a history of code changes moving forward.
I current have a LAMP stack with many virtual hosts in Apache. To begin, I want to focus on my main site which has a development and production stack. Currently, I have two virtual hosts:
dev.mydomain.com
mydomain.com
I work exclusively in the dev.mydomain.com virtual host. I can browse to dev.mydomain.com any time to see my changes in real-time. When I'm comfortable with my changes, I run a bash script to push my changes to production.
sudo rsync -avh --delete --stats --progress /var/www/dev.mydomain.com/ /var/www/mydomain.com/ --exclude-from '/usr/local/bin/exclude.txt'
I want to imitate this idea using git.
Do I install git on the actual web server which is running the sites?
How can I configure git so I as I work on the site, I can still access those changes in real-time at dev.mydomain.com?
I have read over most getting started git tutorials and I understand the basic commands to get started but it's important I keep my same production cycle. Is there a way to achieve that or is there another way that is similar?
You could have two branches (for example master and develop) and use git hooks so that when you push to master the server automatically publishes it on the vhost.
I also think that this could help you.
You install git as a client on each computer.
git depends on branches for most of what you describe.
One example workflow suitable for a solo developer is that you do you development on master and then, as needed you create branches off master reflecting the code at that point. You could call these branches something like prod_mmddyyyy if you want to track them historically by name.
You can also have 'prod' just be a branch that gets updated, e.g. by doing git merge master from the prod branch.
Then you can configure the 'prod' server to be using that branch for its code by git checkout branch_name
You may also find
https://softwareengineering.stackexchange.com/q/111506/34069
useful.

Best way to add an existing repo to git to a different branch behind proxy

There is a website in production.
I want to push the files in Git.
I think the client did copy all the files from his computer to the server using ftp.
I think he pushed his git perso files, cause I can see a .git folder in live.
I tried "git status" on the live server, It returns a list of files.
I did:
git remote show origin
->error: The requested URL returned error: 401 while accessing....
The live site use a proxy.
What's the best way to push the current live site to Github?
I want to create a new branch in github and then, on the server, I want to do:
$ git remote add origin http....
$ git push -u origin newbranch
Do you think there is a way to break the live site?
I have a copy of this website but I don't want to break the current website.
What do you recommend?
First create a backup? Then do the Github thing?
One way to break the live site is if you make an unintended git pull, once you managed to push it to GitHub!
Plus you would need to fiddle with the proxy in order to access to GitHub, all on the production platform.
I would really recommend having nothing on the production server except what is strictly needed to run the web site.
So not git.
Use rsynch/copy mechanism to publish on prod, but keep a git repo on another machine, one which can contact easily Github, and push from there (not from prod)