How do I move my local Git repository to a remote Git repository

后端 未结 8 1624

I have various Git projects that are on my local machine. I have a server that I would like to use as my remote Git Repository. How do I move my local Git Repositories (Pro

8条回答
  •  情深已故
    2020-12-07 09:22

    I have a local repo with commit logs. I wanted to add it a a new github remote repository with all the commit logs preserved. Here is how:

    1. create the remote repo on the github. And get the the repo URL from the "Clone or Download" green button, such as https://github.com/mhisoft/eVault.git

    2. If the local repo was attached to an old orgin. remove it first

      git remote remove origin

    3. Add the existing repository from the command line

      git remote add origin https://github.com/mhisoft/eVault.git

      git push -u origin master

提交回复
热议问题