Skip to content

Instantly share code, notes, and snippets.

@phatblat
Created November 11, 2014 17:39
Show Gist options
  • Save phatblat/843ffecd28ffc84d6442 to your computer and use it in GitHub Desktop.
Save phatblat/843ffecd28ffc84d6442 to your computer and use it in GitHub Desktop.
An example of configuring libgit2 on iOS to use the root CA cert for GitHub
#import <git2/common.h>
NSString *const CACertificateFile_DigiCert = @"DigiCert High Assurance EV Root CA.pem";
NSString *const certFilePath = [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent:CACertificateFile_DigiCert];
NSLog(@"Loading certificate: %@", certFilePath);
const char *file = certFilePath.UTF8String;
const char *path = NULL;
int returnValue = git_libgit2_opts(GIT_OPT_SET_SSL_CERT_LOCATIONS, file, path);
if (returnValue != 0) {
NSLog(@"Error setting SSL certificate location");
}
@lukasredev
Copy link

Thank you very much 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment