Import an existing git project into GitLab?

前端 未结 10 492
南旧
南旧 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:31

    Gitlab is a little bit bugged on this feature. You can lose a lot of time doing troubleshooting specially if your project is any big.

    The best solution would be using the create/import tool, do not forget put your user name and password, otherwise it won't import anything at all.

    Follow my screenshots

    0 讨论(0)
  • 2020-12-07 07:32
    git clone --mirror git@github.com:username/repo-name.git
    
    git remote add gitlab ssh://git@servername.com/username/repo.git
    
    git push -f --tags gitlab refs/heads/*:refs/heads/*
    

    It is better to do it over ssh, the https might won't work

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

    To keep ALL TAGS AND BRANCHES

    Just simply run this command in an existing Git repository

    cd existing_repo
    git remote rename origin previous-hosts
    git remote add gitlab git@git.hutber.com:hutber/kindred.com.git
    git push -u gitlab --all
    git push -u gitlab --tags
    
    0 讨论(0)
  • 2020-12-07 07:41

    This is a basic move one repo to new location. I use this sequence all te time. With --bare no source files will be seen.

    Open Git Bash.
    Create a bare clone of the repository.

    git clone --bare https://github.com/exampleuser/old-repository.git
    

    Mirror-push to the new repository.

    cd old-repository.git
    
    git push --mirror https://github.com/exampleuser/new-repository.git
    

    Remove the temporary local repository you created in step 1.

    cd ../
    rm -rf old-repository.git
    

    Why mirror? See documentation of git: https://git-scm.com/docs/git-push

    --all Push all branches (i.e. refs under refs/heads/); cannot be used with other .

    --mirror Instead of naming each ref to push, specifies that all refs under refs/ (which includes but is not limited to refs/heads/, refs/remotes/, and refs/tags/) be mirrored to the remote repository. Newly created local refs will be pushed to the remote end, locally updated refs will be force updated on the remote end, and deleted refs will be removed from the remote end. This is the default if the configuration option remote..mirror is set.

    0 讨论(0)
提交回复
热议问题