Skip to content
Search

Git:Clone

lastmod 2018-08-17created 2014-07-092 edits

Difference between Bare and Mirror

git clone origin-url (non-bare)
Gets all tags, a local branch master (HEAD) that tracks the remote branch origin/master, and the remote branches origin/next, origiin/pu, and origin/maint. The tracking branch is set up so that when you do something like git fetch origin, it will fetch what you expect. All remote branches and other refs in the cloned remote repository are completely ignored.
git clone --bare origin-url
Gets all tags and the local branches master, next, pu, and maint, but no remote-tracking branches. That is, all branches are copied as they are, and they are set up to be completely independent, with no expectation of fetching again. All remote branches (in the cloned remote) and other refs are completely ignored.
git clone --mirror origin-url
Every last one of those refs will be copied as is. It will get all tags, the local branches master (HEAD), next, pu, and maint, the remote branches devA/master and devB/master, and the other refs refs/foo/bar and refs/foo/baz. Everything is exactly as it was in the cloned remote. Remote tracking is set up so that if you run git remote update, all refs are overwritten from origin, as if you had just deleted the mirror and recloned it. As the documentation said from the start, it is a mirror. It is a functionally identical copy, interchangeable with the original.

Troubleshooting

server certificate verification failed

server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none In this case, apply git-config as below.

$ git config --global http.sslverify false

Or set the environment variable as below and then clone.

export GIT_SSL_NO_VERIFY=1

See also

Favorite site