Export mercurial local repo to GitHub/Bitbucket - github

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

Related

Cloning a repository not locally, but in a server

Let's say I want to clone a Github repo from somebody but not to my local machine, but to my Github so I can work from the Github website and push changes from there. Is this possible? I seem only to be able to "download" locally whenever I want to clone.
Maybe you can fork the repository first. Then edit the forked repo, and then commit the changes on github directly.

Bitbucket to github migration of an already existing repo

we have migrated from bitbucket to github 4 months ago but our team members are still using bitbucket. So, now we have decided to completely moved to Github and use its sevices. So, i want to know whether we can still use mirroring or not to migrate all the changes in bitbucket to github or we have to push it manually or using git push --all.
It depends if there was concurrent activity both on GitHub (the new repository) and BitBucket (the old one)
If that is the case, I would prefer asking each developer, in their own local repository, to:
add the new repository as a remote 'gh'
fetch from it
rebase their branch on top of gh/their-branch (for branches that were modified both on GitHub and BitBucket)
push new branches (done only on BitBucket)
That way, each developer can resolve any conflict locally first, before updating the new GitHub repository.

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.

How can collaborators push their changes to my repo in GitHub

First I have created one project in Eclipse and committed to my GitHub using below commands:git init
git add .
git commit -m "first commit"
git remote add origin URI of my repo
git push -u origin master
Then I modified one file in Eclipse and committed to GitHub from Eclipse through creating remote and giving the remote URI of the repo.
I added my team member through add collaborator.
Then he downloaded my project and made a change in a file in Eclipse.
Now, how can he push that modified file to my GitHub repository from within Eclipse?
We have done one thing. He created a remote and gave the URI of my repo. But still we are unable to commit that file.
You need to add your colleague as a collaborator. This can be done in the desired GitHub repo via Settings > Collaborators (you need to type in your password again). Afterwards they have those permissions.
UPDATE
Sorry and good morning ;)
I overlooked that you already added your partner as a collaborator. Another possible reason for your situation could be in the Temporary interaction limits where you can, amongst others, limit the interaction with your repo to prior contributors.
If that doesn't help. Please add some more informations about your colleague's git logs.
UPDATE 2
#Rahul K regarding your comment (which you better add to your question, for faster recognition), your colleague first needs to integrate the remote changes via git pull origin master in order to be able to push his or her changes afterwards. But be aware that he or she might need to migrate any conflicts to files both of you applied changes to.
Best regards, David
I have resolved the issue by cloning the repo in my local folder, adding the project to eclipse and changing the file committed.
Before that you have to add that person as a collaborator. So that he/she can clone your repo using the command below:
git clone "Path to the repository"
This is an old question but I'll like to say this to help others that might still be facing this same issue.
I also faced this issue with a friend. I already made him a collaborator but he couldn't push. What we did to solve it was to clone the repo using the ssh url instead. Then we set up authentication in git with ssh. And we were able push successfully.
If you already cloned the repo with the usual HTTPS url, you can change the remote origin url using the git remote set-url origin <url> command but url here will be the ssh url.

Github for Windows Pull Request for remote Bitbucket Repo

Based on this tutorial I was able to successfully connect Github for Desktop with my remote Bitbucket repo.
Looking at the example tutorial repo I see there is an Pull Request option built in the application - great:
However the option is missing when I chose my remote Bitbucket repo:
I couldn't find any option that is reponsible for this.
Anyone knows what affects this behavior?
"Pull Request" is very much a GitHub feature, associated to GitHub repos.
So For BitBucket, the simplest approach is to push your feature branch to the remote repo (which is a BitBucket one, not a GitHub one), and make your PR from there (from the remote BitBucket web GUI, even within the same repo)
Once the PR is initiated, each push done from the GitHub Desktop will complete said PR.
In Bitbucket go to Settings -> Branch Permissions, and add a new branch permission with your name.
EDIT
https://stackoverflow.com/a/37343356/1544886