Import an existing git project into GitLab?

前端 未结 10 504
南旧
南旧 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.

    0 讨论(0)
  • 2020-12-07 07:20

    Moving a project from GitHub to GitLab including issues, pull requests Wiki, Milestones, Labels, Release notes and comments

    There is a thorough instruction on GitLab Docs:

    https://docs.gitlab.com/ee/user/project/import/github.html

    tl;dr

    • Ensure that any GitHub users who you want to map to GitLab users have either:

      • A GitLab account that has logged in using the GitHub icon - or -
      • A GitLab account with an email address that matches the public email address of the GitHub user
    • From the top navigation bar, click + and select New project.

    • Select the Import project tab and then select GitHub.
    • Select the first button to List your GitHub repositories. You are redirected to a page on github.com to authorize the GitLab application.
    • Click Authorize gitlabhq. You are redirected back to GitLab's Import page and all of your GitHub repositories are listed.
    • Continue on to selecting which repositories to import.

    But Please read the GitLab Docs page for details and hooks!

    (it's not much)

    0 讨论(0)
  • 2020-12-07 07:21

    You create an empty project in gitlab then on your local terminal follow one of these:

    Push an existing folder

    cd existing_folder
    git init
    git remote add origin git@gitlab.com:GITLABUSERNAME/YOURGITPROJECTNAME.git
    git add .
    git commit -m "Initial commit"
    git push -u origin master
    

    Push an existing Git repository

    cd existing_repo
    git remote rename origin old-origin
    git remote add origin git@gitlab.com:GITLABUSERNAME/YOURGITPROJECTNAME.git
    git push -u origin --all
    git push -u origin --tags
    
    0 讨论(0)
  • 2020-12-07 07:26

    rake gitlab:import:repos might be a more suitable method for mass importing:

    • copy the bare repository under repos_path (/home/git/repositories/group/repo.git). Directory name must end in .git and be under a group or user namespace.
    • run bundle exec rake gitlab:import:repos

    The owner will the first admin, and a group will get created if not already existent.

    See also: How to import an existing bare git repository into Gitlab?

    0 讨论(0)
  • 2020-12-07 07:27

    Add the new gitlab remote to your existing repository and push:

    git remote add gitlab url-to-gitlab-repo
    git push gitlab master
    
    0 讨论(0)
  • 2020-12-07 07:31

    Here are the steps provided by the Gitlab:

    cd existing_repo
    git remote rename origin old-origin
    git remote add origin https://gitlab.example.com/rmishra/demoapp.git
    git push -u origin --all
    git push -u origin --tags
    
    0 讨论(0)
提交回复
热议问题