       gitPackageInfo = @getHostedGitInfo(name)
 
       if gitPackageInfo
-        targetDir = path.join(@atomGitPackagesDirectory, gitPackageInfo.project)
-        @installGitPackage gitPackageInfo, targetDir, (error) =>
-          return callback(error) if error
-          pack =
-            name: gitPackageInfo.project
-          installDirectory = temp.mkdirSync('apm-install-dir-')
-
-          tasks = []
-          tasks.push (cb) -> fs.cp(targetDir, installDirectory, cb)
-          tasks.push (cb) =>
-            options.cwd = installDirectory
-            @installDependencies(options, cb)
-          tasks.push (cb) -> fs.cp(installDirectory, targetDir, cb)
-          async.waterfall tasks, options.callback
-
+        @installGitPackage gitPackageInfo, options, options.callback
       else if name is '.'
         @installDependencies(options, callback)
       else # is registered package

  createAtomDirectories: ->
    fs.makeTreeSync(@atomDirectory)
    fs.makeTreeSync(@atomPackagesDirectory)
    fs.makeTreeSync(@atomNodeDirectory)

  # Compile a sample native module to see if a useable native build toolchain

  getHostedGitInfo: (name) ->
    hostedGitInfo.fromUrl(name)

  installGitPackage: (gitPackageInfo, options, callback) ->
    cloneDir = temp.mkdirSync("atom-git-package-clone-")
    tasks = []

    tasks.push (cb) => @cloneGitPackage gitPackageInfo, cloneDir, cb
    tasks.push (cb) => @installGitPackageDependencies(cloneDir, options, cb)
    tasks.push ({name}, cb) =>
      targetDir = path.join(@atomGitPackagesDirectory, name)
      fs.cp cloneDir, targetDir, cb

    async.waterfall tasks, callback

  installGitPackageDependencies: (directory, options, callback) =>
    tasks = []

    options.cwd = directory
    tasks.push (cb) => @installDependencies(options, cb)
    tasks.push (cb) -> CSON.readFile(CSON.resolve(path.join(directory, 'package')), cb)

    async.waterfall tasks, (err, metadata) ->
      callback(err, metadata)

  cloneGitPackage: (packageInfo, cloneDir, callback) ->
    Develop = require './develop'
    develop = new Develop()

    if packageInfo.default is 'sshurl'
      url = packageInfo.toString()
      develop.cloneRepository url, cloneDir, {}, callback
    else if packageInfo.default is 'https'
      develop.cloneRepository name, cloneDir, {}, callback
    else if packageInfo.default is 'shortcut'
      url = packageInfo.https().replace(/^git\+https:/, "https:")
      develop.cloneRepository url, cloneDir, {}, (error) ->
        if error
          # more error checking to make sure failure is because of protocol
          url = packageInfo.sshurl()
          develop.cloneRepository url, cloneDir, {}, callback
        else
          callback()

