'Cloning a git repo in GitLab - specific requirements

I have a git repo that I have worked on for some time. It is cloned on my pc and has a few branches. I want to recreate this repo on GitLab along with all history and branches. I have seen that if the repo is accessible using a url it is easy to clone. But unfortunately mine is not. Any ideas how this can be accomplished. I have tried to upload the local repo folder to Azure storage account to make is publicly accessble but couldnt get the import working. Thanks



Solution 1:[1]

If you have the local repository, with local branches (meaning not remote tracking branches in an origin/<branches> list), you can use git push --mirror to push it to a new GitLab project.

cd /path/to/local/repo
git remote add origin https://gitlab.com/<me>/<newRepo>
git push --mirror

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 VonC