Category: git

How to mirror a git repository

As I was working on libgnusocial I went into trouble because we have three different git repositories: Gitlab, Github & code.freedombone.net and I wanted to keep them all updated. To do this I just work with one (at Gitlab) and I treat the others as mirrors. First of all, to mirror a git repository we need to clone it using the “mirror” argument:

$ git clone --mirror https://gitlab.com/user/repository

Then move into the cloned repository directory (which git ends in “.git” due to the mirror cloning process):

$ cd repository.git

And finally push into an empty repository or an outdated mirror of our repository:

$ git push --mirror https://gitlab.com/user/another_repository

Skip SSL validation while cloning a Git repository

While I was trying to clone the libmicrohttpd Git repository I got the following fail:

fatal: unable to access 'https://gnunet.org/git/libmicrohttpd.git/': server certificate verification failed.

 

The easy way to fix it’s disable the SSL verification at the same command line where we clone the repository, by setting the GIT_SSL_NO_VERIFY variable to “true”.

$ GIT_SSL_NO_VERIFY=true git clone --recursive https://gnunet.org/git/libmicrohttpd.git/

 

We’ll get our local copy of the repository. If we’re going to work on it rather than just compiling or installing (that was my case) then we can disable SSL certification checking for that repository:

$ git config http.sslVerify "false"