Search code examples
gitgit-extensions

Migrating a GIT Repository to the Cloud


I am currently working in a repository that is stored on our locally hosted network at:
http://git.**company**.internal/Development/repo.git

The company is in the process of moving everything to the cloud instead of hosting everything ourselves. It seems like a convenient time to move the GIT repository to the cloud as well. It's been a while since I've done much besides pushing, pulling, and merging to the repo - so I don't want to mess this up. I want to create a separate repo stored based in the cloud and change my local directory to point to the new repo instead of the old one.

As I said, I am fuzzy on the GIT commands to do this - so it may just be simple.

My idea is - I need to fork the current repository, cd into a directory that is stored on the cloud, clone(?) that repository, and then pointing my working directory to the new one is a mystery to me.

I'm sorry if this is confusing, my understanding of GIT is lackluster. I can provide clarification on what I am looking for if this isn't clear.


Solution

  • For Github:

    1. Create new repository in Github and don't create a readme file.

    2. Clone the mentioned repository from your server to your local machine.

    3. git remote add origin <url> (url of the new github repo)

    4. git push origin master

    Note: you shouldn't commit because you probably already have commits in this repository, just add a new remote I called it origin and push it to the Github server