diff --git a/Library/Homebrew/cmd/pull.rb b/Library/Homebrew/cmd/pull.rb
index cf0b745437231ecf37d1358a68a0e9af741ef3c5..ac43bdad645552157eab1d3e2855b71c4a3bebe8 100644
--- a/Library/Homebrew/cmd/pull.rb
+++ b/Library/Homebrew/cmd/pull.rb
@@ -152,6 +152,10 @@ module Homebrew
         safe_system "git", "checkout", branch
         safe_system "git", "merge", "--ff-only", "--no-edit", bottle_branch
         safe_system "git", "branch", "-D", bottle_branch
+
+        # TODO: publish on bintray
+        # safe_system "curl", "-u#{user}:#{key}", "-X", "POST",
+        #   "https://api.bintray.com/content/homebrew/#{repo}/#{formula}/#{version}"
       end
 
       ohai 'Patch changed:'
diff --git a/Library/Homebrew/cmd/test-bot.rb b/Library/Homebrew/cmd/test-bot.rb
index 2617aee87addabe87eb5c89c2999a993a91f1d14..732b44581816c3ea6063a8086484cd1ca15d7814 100644
--- a/Library/Homebrew/cmd/test-bot.rb
+++ b/Library/Homebrew/cmd/test-bot.rb
@@ -666,6 +666,10 @@ module Homebrew
       id = ENV['UPSTREAM_BUILD_ID']
       raise "Missing Jenkins variables!" unless jenkins and job and id
 
+      user = ENV["BINTRAY_USER"]
+      key = ENV["BINTRAY_KEY"]
+      raise "Missing Bintray variables!" unless user && key
+
       ARGV << '--verbose'
 
       bottles = Dir["#{jenkins}/jobs/#{job}/configurations/axis-version/*/builds/#{id}/archive/*.bottle*.*"]
@@ -706,6 +710,7 @@ module Homebrew
       tag = pr ? "pr-#{pr}" : "testing-#{number}"
       safe_system "git", "push", "--force", remote, "master:master", ":refs/tags/#{tag}"
 
+      # SourceForge upload (will be removed soon)
       path = "/home/frs/project/m/ma/machomebrew/Bottles/"
       if tap
         tap_user, tap_repo = tap.split "/"
@@ -717,6 +722,30 @@ module Homebrew
       rsync_args += Dir["*.bottle*.tar.gz"] + [url]
 
       safe_system "rsync", *rsync_args
+
+      # Bintray upload (will take over soon)
+      repo = if tap
+        tap.sub("/", "-") + "-bottles"
+      else
+        "bottles"
+      end
+
+      Dir.glob("*.bottle*.tar.gz") do |filename|
+        # Skip taps for now until we're using Bintray for Homebrew/homebrew
+        next if tap
+        version = BottleVersion.parse(filename).to_s
+        formula = bottle_filename_formula_name filename
+
+        package_url = "https://api.bintray.com/packages/homebrew/#{repo}/#{formula}"
+        unless system "curl", "--silent", "--fail", "--output", "/dev/null", package_url
+          safe_system "curl", "-H", "Content-Type: application/json",
+            "-d", "{'name':'#{formula}','licenses':['MIT']}", package_url
+        end
+
+        safe_system "curl", "-u#{user}:#{key}", "-T", filename,
+          "#{package_url}/#{version}/#{filename}"
+      end
+
       safe_system "git", "tag", "--force", tag
       safe_system "git", "push", "--force", remote, "refs/tags/#{tag}"
       return
diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb
index a1fba5661a85669346f6f82724b49ee2bd2fbbab..f0e0c34932949cc08238481415d2fc2923c60f30 100644
--- a/Library/Homebrew/software_spec.rb
+++ b/Library/Homebrew/software_spec.rb
@@ -251,7 +251,11 @@ end
 class BottleSpecification
   DEFAULT_PREFIX = "/usr/local".freeze
   DEFAULT_CELLAR = "/usr/local/Cellar".freeze
-  DEFAULT_ROOT_URL = "https://downloads.sf.net/project/machomebrew/Bottles".freeze
+  if ENV["HOMEBREW_BINTRAY_TESTING"]
+    DEFAULT_ROOT_URL = "https://bintray.com/artifact/download/homebrew/bottles".freeze
+  else
+    DEFAULT_ROOT_URL = "https://downloads.sf.net/project/machomebrew/Bottles".freeze
+  end
 
   attr_rw :root_url, :prefix, :cellar, :revision
   attr_reader :checksum, :collector