Note: By default, you will use Git to manage your code and upload it to a remote Git repository

If there are any mistakes, please leave a message and I will correct them

The first step is to add a remote private index repository

  • The login page is displayed after registration

  • Click Add project

  • Click Create project to jump to the interface

  • Click the code TAB on the left to access the private remote cocoaPods repository interface

  • Open the terminal and enter the specified POD repo

    • As you can see, cocoaPods is currently linked to a remote repository. The URL is the remote repository on Github, and the Path is downloaded to the local repository via Pod Setup
  • You can enter the instruction pod repo –help to see what commands the current POD repo has

  • Enter pod repo add repository name Repository SSH(HTTPS) address to add a remote index repository

  • The SSH(HTTPS) address of the warehouse is in the following figure on the code market

  • Enter the pod repo command again

    • LTPodspecs is the remote private index library I just added

Second, configure a private code repository

  • Open the code market and add a new project. This project is a private repository managed by CocoaPods to store the code that needs to be managed, unlike the index library created above

  • I created a new folder on my desktop to configure the private code base

  • Use terminal CD to current folder

  • Enter the command to create a git repository pod lib create repository name

    • This repository is used to test and upload private code
  • Git local repository created

  • Open the test project, locate the replaceme. m file and delete it

  • Find the source code that needs to be managed by CocoaPods private repository (in my case, the Category folder) and drag the code file into the Classes folder and select Copy Items if needed

  • You can use Show In Finder to see the actual location of the drag-in folder

  • Since the LTCategorys file referenced after the test project was created does not contain the Category folder that was just dragged in, you need to re-pod install

    • CD to the test project folder and run the pod install command
  • At this point, files in the Category dragged into the project can be used normally, using the local private library

  • Open the test project and configure the PodSpec file in the following location

  • Simple explanation

    • S. homepage needs to set the address of the private repository you just created, not the private index library
    • S.ource Needs to set the source address of the private repository (choose HTTPS address)
  • Upload the newly created local repository to the project and tag it with the same version as the one in the podSpec file above (mine is 0.1.0, so I tagged it with 0.1.0).

  • Open the terminal, CD to the LTCategorys folder (a local repository created using the pod lib screate command), and use the pod lib lint and podspec lint commands respectively to perform local and remote podspec verification

  • When the above steps are complete, you need to upload the LTCategorys. Podspec file to the local private index library, which will then be automatically uploaded to the remote private library

    • An endpoint uses a POD repo file to view an existing index library
    • CD to LTCategorys, then pod repo push index library name podSpec file name
  • Index files in remote index libraries

  • Create a test project on your desktop

  • CD to the Test folder and create a Podfile using the terminal calling the POD init command

  • Call the pod repo command to view the URL of the current index library

  • Open the Podfile file in Test and fill in the following

  • CD to the Test folder, use the terminal to execute the pod install command, and the two third-party code has been successfully installed into the project

  • Open the Test project and you can see the installed third-party libraries, AFNetworking(public library) and LTCategorys(remote private library).

The last

  • The LTPodspecs private library is created to hold the CocoaPods index file (podSpec type)
  • The LTCategorys private library was created to house remote private code (share the open source with Github)
  • Using LTPodspecs to hold LTCategorys podSpec files is the heart of the remote private library
  • Finally, you can use CocoaPods to install SSH private library code, which can only be used by yourself and your designated people. (For others to use, you must add your CocoPods private library and set the public key of SSH in your market account.)
  • Later private remote code can also be managed using this LTPodspecs index library

Next: iOS Development: CocoaPods remote private repository maintenance upgrades