In order to access your Github you need to do it via ssh. So you need to add your ssh public key to github. After that you are able to access github via ssh i.e.:
git init git@github.com:yourname/yourrepo.git
See also: Github: generating ssh keys, WikiHow
[Edit #1]
without certificate checks:
GIT_SSL_NO_VERIFY=true git clone https://github.com/p/repo.git
or authenticated
GIT_SSL_NO_VERIFY=true git clone https://user@pass:github.com/p/repo.git
For me it is still not clear what are you asking for, because you know that installing ca-certificates will fix the problem.
[Edit #2]
Ok, the other question was
how to have only the certificate which is needed to access github.com via https
Open your browser and navigate to https://github.com/.
Klick on the green name on the left from https://
and klick on
Certificates
. On the Details
tab, you'll see the
certificate chain, which is:
DigiCert ...
DigiCert ...
github.com ...
Export each of the DigiCert certicates to a file.
- copy the files to
/etc/ssl/certs/
- run
c_rehash
which cat all certificates to ca-certificates.crt
- you are done.
As I said, I am not a friend of such actions because github can change the CA's anytime,
so it will always result in additional work.
This can be done by using a custom dlagent. I do not really understand Arch packaging or how the dlagents work, so I only have a hack answer, but it gets the job done.
The idea is to modify the PKGBUILD to use a custom download agent. I modified the source
"${pkgname%-git}::git+http://github.com/Itseez/opencv.git"
into
"${pkgname%-git}::mygit://opencv.git"
and then defined a new dlagent called mygit
which does a shallow clone. I did this by adding to the DLAGENTS
array in /etc/makepkg.conf
the following dlagent:
'mygit::/usr/bin/git clone --depth 1 http://github.com/Itseez/opencv.git'
My guess is you could probably define this download agent somewhere else, but I do not know how. Also notice that the repository that is being cloned is hard coded into the command. Again, this can probably be avoided. Finally, the download location is not what the PKGBUILD expects. To work around this, I simply move the repository after downloading it. I do this by adding
mv "${srcdir}/../mygit:/opencv.git" "${srcdir}/../${pkgname%-git}"
at the beginning of the pkgver
function.
I think the cleaner solution would be to figure out what the git+http
dlagent is doing and redfine that temporarily. This should avoid all the hack aspects of the solution.
Best Answer
You will end up downloading the entire history, so I don't see much benefit in it, but you can checkout specific parts using a "sparse" checkout. Quoting this Stack Overflow post:
I'm going to interrupt here. Since I'm quoting another post, I don't want to edit the quoted parts, but do not use
-f
withgit remote add
. It will do a fetch, which will pull in the entire history. Just add the remote without a fetch:And then do a shallow fetch like described later.
You might be better off using a shallow clone. Instead of a normal
git pull
, try:I had an occasion to test this again recently, trying to get only the Ubuntu Mono Powerline fonts. The steps above ended up downloading some 11 MB, where the Ubuntu Fonts themselves are ~900 KB:
A normal
clone
took about 20 MB. There's some savings, but not enough.Using the
--filter
+ checkout method in Ciro Santilli's answer really cuts down the size, but as mentioned there, downloads each blob one by one, which is slow:TL;DR: Use all of
--filter
, sparse checkout and shallow clone to reduce the total download, or only use sparse checkout + shallow clone if you don't care about the total download and just want that one directory however it may be obtained.