wiki:howto/SyncingWithGit

<- Back to the HOWTO section

How to sync your ports tree using Git over HTTPS

  • Audience: end users who cannot use rsync (873/tcp) due to firewalls, proxies, policy, etc.
  • Requires: MacPorts
  • Requires: Git

Introduction

Some people live and work behind a firewall or proxy that blocks or otherwise breaks rsync, which is the primary means of getting updated Portfiles in MacPorts. The following steps will switch your tree over to using Git over HTTPS for syncing.

Note: if you are using a custom prefix, you will have to replace the default of /opt/local with the location of your MacPorts install in the instructions below.

Installation

Step 0: Install Git

Git already comes pre-installed with Xcode. Most users will not need to install it manually. If you are unsure whether you already have it installed, check with this command:

git --version

Unless you see an error message with command not found, you already have git and can skip this step.

Continue only if you do not already have git installed. If you have a copy of the ports tree already, just run:

sudo port install git

If you do not have a copy of the ports tree, you can download the daily tarball by following the tarball howto.

Step 1: Checkout Initial Copy

cd /opt/local/var/macports/sources
sudo mkdir -p github.com/macports/macports-ports/
sudo chown -R $USER:admin github.com
git clone https://github.com/macports/macports-ports.git github.com/macports/macports-ports/

Configuration

Step 2: Configure MacPorts

Edit /opt/local/etc/macports/sources.conf to comment out the rsync:// entry and add a new file:/// entry:

Note: if you need to replace /opt/local with your custom prefix, make sure the initial "file:///..." contains three slashes.

#rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default]
file:///opt/local/var/macports/sources/github.com/macports/macports-ports/ [default]

Step 3: Sync

On running your first sync you will have wait for the PortIndex to be generated, which will take some time. Subsequent runs will be faster, as only changed Portfiles need to be indexed again. Use the -v flag for verbose mode which will show you the progress of this operation.

sudo port -v sync

After this has finished, you are now receiving your Portfiles using Git instead of rsync.

See also

Additional topics related to MacPorts and Git:

<- Back to the HOWTO section

Last modified 9 months ago Last modified on Mar 11, 2017, 4:20:33 PM