Saturday, March 21, 2015

Exporting an existing local Git repository to Github

To do so, I followed the Github documentation:

    https://help.github.com/articles/importing-a-git-repository-using-the-command-line/

. It worked. In this blog, I am trying to understand what exactly I have done.

On a remote computer (IP 192.168.1.5), I did some work that I wanted eventually to go to Github, so that I would be able to access my work from anywhere. I renamed the root directory of the project containing this work to minetats-webapp.git, so that the name would correspond to the empty Github repository I created following the doc mentioned above. On that computer, I created a Git repository with cd minetats-webapp.git && git init.

On the local computer, I cloned that repository with

git clone --bare ssh://192.168.1.5:/home/alec/project/minetats-webapp.git

. Then I did


cd minetats-webapp.git/
git push --mirror https://github.com/amissine/minetats-webapp.git

, and it worked. Before I ran cd .. && rm -rf minetats-webapp.git to clean up,
I took a look at what was inside the directory I was about to remove. The directory contained what a typical .git directory inside a Git repository would contain. So much for understanding. When I cloned my work from Github to test it locally,

git clone https://github.com/amissine/minetats-webapp.git

, it was successfully cloned into minetats-webapp.

No comments:

Post a Comment