How to import projects from a private Github server

I have been reading the GiitLab documentation about importing projects from various different repos (Bitbucket, other GitLab repos, etc) and have been particularly interested in how to import repos from Github. The procedure looks pretty straightforward and relatively simple – except for one problem.

The instructions presume that the import is from Github repos on Github. Unfortunately, I do not have any repos, public or private, on the main public Github server (https://github.com/). What I have is a NAS that has a private (protected and behind a firewall) Github server running on it. I would like to migrate the repos on that server over to Gitlab.

I cannot find anything in the documentation that describes how to import from a server other than https://github.com/. The importer seems to assume that that is the only Github server that someone would like to import from.

Is there a way to point the importer so that it can import Guthub repos from my NAS-based Github server? Or am I going to have to put them on github.com or (worse) create new projects on Gitlab?

Use the option for “repository by URL” - it doesn’t matter then what your private server is running. You will have to open up access from the outside though so that gitlab.com can connect to your Git server, and you can ensure authentication is required/enabled for that server so that it isn’t publicly browseable.

iwalker:

Thanks for the info. I have one last question, though.

My Github server is running on a Synology NAS and can only be accessed through ssh. Is there an importer that can access a repo using ssh? Or must all access be through https?

From clicking New Project → Import Project, and then selecting repository by URL it explains the following:

I assume using git:// means accessing it via SSH. You will have needed to upload an SSH key to your Gitlab profile that does have access to your Git server.

Hold on:

According to the git documentation the git:// prefix is not ssh, but is a separate protocol going in through port 9418. My NAS only supports ssh (actually, most Linux Git servers only do ssh). GitLab, on the other hand, does not appear to support access to git repos through ssh (actually, it was reading the explanation that you referred to when I first attempted the import that caused me to ask the question I asked in the first place!).

Based on what you are telling me, it appears that there really isn’t any way to import repos from most private Git servers. There are exceptions, but Synology’s Git server isn’t one of them. This is a major inadequacy in both GitLab and Synology’s server.

The only way this wouldn’t be true is if the git:// protocol actually uses ssh. Nothing I have seen indicates that it does.

If your NAS/Git server only supports ssh, then that is a bit poor. I’m surprised it doesn’t support HTTP or HTTPS like pretty much all other servers like Gitlab, Bitbucket, Gitea, Github, Jetbrains Spaces, etc. If they are private, irrespective of the ones I mentioned, you have to allow access to it - otherwise how else can it connect and import?

Most Git servers like the ones I mentioned, also allow you to export to an archive file. Does yours allow this, or is this also functionality that your git server doesn’t have?

The limitation here isn’t Gitlab, but rather your server, and lack of access to it. Also to correct, Git Server on a Synology is not Github. On-site versions of Github are called Github Enterprise. So when you initially chose Github, you were choosing the wrong option totally.

Another thing you can do if exporting is not an option, is to have all your repositories cloned locally on your machine, and then change the remote url to Gitlab, ensure a blank project is created on Gitlab, and then push the project to the new server. So yes, whilst the worst option you mentioned in your original post, unfortunately that’s due to the Git server you are running, and not a limitation of Gitlab, but a limitation of yours because it’s such a basic Git server.

1 Like

Actually:

I found a solution to the problem. It turns out that the server installed on my NAS is, behind Synology’s UI, is a standard Linux based git server. As such, I was able to log in and run a git daemon which supports access through the git:// protocol. I ran into a few other problems, including a problem with whitelisting, but I was eventually able to export one of my projects over to Gitlab.

I am now transferring all my stuff over to Gitlab.

Thanks for your assistance. I wouldn’t have figured this out without your advice.

2 Likes

Wow nice, glad you were able to at least run that additional process.

You can also run Gitlab on Synology in Docker. Some people like doing that. I personally am not a great fan of docker, for some apps yes, but I think some just don’t suit it well - especially when it comes to administration I think it’s easier to manage a physical VM with Gitlab than a docker container. But each to their own :slight_smile:

Gitlab SaaS (gitlab.com) does have user limits, but if it is only you who will work on your repos then you will be fine. Max is 5 users for free working on a repo/project.