CocoaPods Git Private Repo
A CocoaPods plugin that simplifies accessing private git repositories using SSH keys during pod installation. This plugin enables seamless authentication with private git repositories by automatically applying the correct SSH key for each repository.
Features
- Automatically uses specified SSH keys for private git repositories
- Supports different SSH keys for different repositories
- Configurable via a simple JSON file
- Works with standard CocoaPods installation workflow
Installation
$ gem install cocoapods-git-private-repo
Usage
Configuration File
For managing multiple private repositories with different keys, create a keys.json
file in your project root with the following format:
[
{
"url": "git@github.com:organization/repo-1.git",
"key_path": "~/.ssh/id_rsa"
},
{
"url": "git@github.com:organization/repo-2.git",
"key_path": "~/.ssh/custom_key"
}
]
The plugin will automatically:
- Read the configuration file
- Match repository URLs against the configuration
- Use the appropriate SSH key for each repository
How It Works
The plugin extends CocoaPods' Git downloader to:
- Check for a repository URL match in your configuration
- Override the git command to use the specified SSH key
- Handle the authentication process automatically
This approach avoids the need to:
- Modify your SSH config for each repository
- Use different SSH clients for different repositories
- Manually handle key-based authentication
Troubleshooting
If you encounter issues:
- Ensure your SSH keys have the correct permissions
- Verify the key paths in your configuration are correct and accessible
- Check that the repository URLs in your configuration exactly match those in your Podfile
- Enable verbose CocoaPods output for debugging:
$ pod install --verbose
Development
- Clone this repository
- Run
bundle install
to install dependencies - Run
bundle exec rake spec
to run the tests - Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
License
This project is licensed under the MIT License - see the LICENSE.txt file for details