Upload packages to Gemfury with Git

In addition to uploading prebuilt packages into your account, you can now skip the build step and git push the source of your package directly to Gemfury. We will build and add it to your account.

Initial setup

Use the following command to add Gemfury repo to your package. This setup only needs to be done once :

$ git remote add fury https://git.fury.io/username/package-name.git

Username can be yours or any of the account usernames on which you collaborate. Package-name should be the name of your package – no additional slashes are permitted in this URL.

Pushing a new package version

Once you have added this remote repository, you can push updates to your package by running:

$ git push fury master

Gemfury will only build the remote master branch. To build off a different branch, specify one as follows:

$ git push fury stable:master

How a package is built

When you push your repository to Gemfury, we will securely store it and kick-off a build from the master branch that will place one or more packages into your account. The Git repository and the individual packages are stored and managed separately.

Unless you’ve configured your build via .fury.yml, Gemfury will try to auto-detect a single package builder by iterating through the supported package types and choosing the first match. The package types are checked and selected in arbitrary order, thus we recommend pre-configuring your builds via .fury.yml

Customizing what to build

Some of you may choose to build multiple packages from a single repository. In default mode, our Git builder will only auto-detect and build the first package type that it finds. To override that, you will need to manually specify what to build via a configuration file.

Securely accessing your account

When peforming git push to Gemfury, enter your account credentials as follows:

$ git push fury master
Username for 'https://git.fury.io': <Your username>
Password for 'https://user@git.fury.io': <Your password or API token>

For your security, these credentials will be requested every time you perform a push. If you’d like to avoid entering them every time, you can configure Git to store them.

Storing credentials with .netrc and Gemfury CLI

Git client automatically checks ~/.netrc for credentials corresponding to the repo hostname. You can therefore add the following section and store your Gemfury credentials for Git:

machine git.fury.io
  login     <personal-email>
  password  <password-or-api-token>

Gemfury CLI will help you manage your ~/.netrc credentials by populating the above-mentioned git.fury.io section automatically after you sign in. It will also erase that section on fury logout.

Storing credentials with credential.helper

You can also enable one of the following credential.helper configurations to store your credentials either in memory or on disk:

# Temporarily cache credentials for 1 hour
$ git config --global credential.helper 'cache --timeout 3600'
# ... or permanently store them in ~/.git-credentials
$ git config --global credential.helper store

If you’re using OSX and have installed Git using homebrew, you can securely store your credentials in the OSX keychain:

$ git config --global credential.helper osxkeychain

Versioning

git push will build your package from the tip of master branch and use the version specified in your corresponding package metadata file. Alternatively, PHP Composer packages can be versioned using Git tags.

Subsequent pushes of a duplicate version of a package to your account will be ignored.

Limitations

This feature is only available for the following package managers:

  • RubyGems
  • Node.js npm
  • Python pip
  • PHP Composer

Status & Feedback

We’ve tested Git support in a number of scenarios, but we would like to make sure this fits seamlessly into your workflow. Once you try it, please email us with your thoughts and reflections, good or bad, about your experience.