Skip to content

Swift package that wraps the libgit2 library and provides an API to manipulate Git repositories

License

Notifications You must be signed in to change notification settings

mfcollins3/libgit2-apple

Repository files navigation

libgit2 Swift Package

Overview

This repository implements a Swift package that builds, includes, and wraps the libgit2 library. This Swift package provides a Swift API that wraps the libgit2 C APIs and allows macOS, iOS, and iPadOS applications to clone and work with Git repositories.

The libgit2 library that this package builds and wraps was built on top of libssh2 and OpenSSL.

This Swift package supports the following platforms:

  • macOS (Apple Silicone and Intel)
  • iOS (64-bit only)
  • iOS Simulator (Apple Silicone and Intel)
  • macOS Catalyst (Apple Silicone and Intel)

⚠️ Please note that in order to use this Swift package, you must also agree to the license terms for libgit2, libssh2, and OpenSSL:

Building libgit2

⚠️ Building libgit2 requires you to have installed and build the following prerequisite frameworks first:

The build process for libgit2 assumes that OpenSSL and libssh2 are siblings in the same parent directory of the file system and will look for them in the ../openssl-apple and ../libssh2-apple paths.

If you need to build libgit2 yourself, I have provided the build.sh program to automate the process. This program will build libgit2 for all supported platforms and will produce the XCFramework containing the libraries and header files for each platform.

This repository includes the source code for libgit2 as a Git submodule. To begin, you need to close the repository and load the submodules:

git clone https://github.com/mfcollins3/libgit2-apple.git
cd libssh2-apple
git submodule init
git submodule update

After cloning the repository, you can run the build.sh program without any arguments to build the libgit2 library and produce the XCFramework.

About

Swift package that wraps the libgit2 library and provides an API to manipulate Git repositories

Resources

License

Stars

Watchers

Forks

Packages

No packages published