Import an existing git project into GitLab?

前端 未结 10 493
南旧
南旧 2020-12-07 06:50

I have an account of a Gitlab installation where I created the repository \"ffki-startseite\"

Now I want to clone the repository git://freifunk.in-kiel.de/ffki

10条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 07:19

    I was able to fully export my project along with all commits, branches and tags to gitlab via following commands run locally on my computer:

    To illustrate my example, I will be using https://github.com/raveren/kint as the source repository that I want to import into gitlab. I created an empty project named Kint (under namespace raveren) in gitlab beforehand and it told me the http git url of the newly created project there is http://gitlab.example.com/raveren/kint.git

    The commands are OS agnostic.

    In a new directory:

    git clone --mirror https://github.com/raveren/kint
    cd kint.git
    git remote add gitlab http://gitlab.example.com/raveren/kint.git
    git push gitlab --mirror
    

    Now if you have a locally cloned repository that you want to keep using with the new remote, just run the following commands* there:

    git remote remove origin
    git remote add origin http://gitlab.example.com/raveren/kint.git
    git fetch --all
    

    *This assumes that you did not rename your remote master from origin, otherwise, change the first two lines to reflect it.

提交回复
热议问题