How do I mirror Github page for local browsing? - github

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.

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?

Export mercurial local repo to GitHub/Bitbucket

I have a local mercurial repo on my desk, and I want to upload it to bitbucket, or github, so it can be viewed on the web.
So far I am stucked at the import phase, both GitHub or Bitbucket request that I provide an URL for my repo (i'd have prefer a simple path on my disk, to the repo).
I've started a local server but then the address:
http://localhost:8000/Myrepo/
failed to be acceded.
I know about the tortoiseHg Hg-Git plugin and I tried to make a push git://... but it failed too.
So my first question is: how to I put my mercurial repo on the web so it can be imported ?
My second question is: what's the point of having a bitbucket / github account if I have to set an online, public, mercurial server on the web to push to them ?
What I would like is to continue to work locally, then push to bitbucket / github, without having to set up a mercurial server.
Thanks
Problem: You have an existing local (mercurial or git) repo and want to transfer it to bitbucket
Short answer:
Create a new empty(!) repository in bitbucket
Copy the bitbucket URL of the new empty repo
Push your existing old repo to the address of the new bitbucket repo
Now the bitbucket repo is overwritten with the history of your existing (old) repo.
I just tested it and it worked perfectly :-)
The detailed answer to your Problem is explained here:
https://confluence.atlassian.com/bitbucket/push-versioned-code-to-an-empty-repository-877177145.html

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 do I pull changes from github repository to my local machine?

I've seen several questions/answers very similar to this but still not sure I understand if they are what I need. So accept my apologies if this was covered before by something similar.
I have a private GitHub account with several repositories. I created these from my mac, pushed them to GitHub and everything works great.
From my Ubuntu desktop, I did a git clone and pulled a couple of the repositories to that desk top. Now from Ubuntu, I make a change to a file, add it, commit it, and push it to GitHub.
Question:
How (what command) on my mac do I use to pull that change down to my local repository so I get that change(s)? UserName is JohnCowan, repo is sacnomadgolf.git
Thanks for the help.
You said you made the repo on your Mac. Then you can just do git pull in the folder you have the repository in.
A really good resource on Git, with explanatory illustrations about the "Git workflow":
http://git-scm.com/doc

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)