When it comes to private repositories, there are a couple of problems with the current implementation in DrushMakeDownload_Git.

A. When using a private repository, the SSH URL needs to be used no matter whether requesting a working copy or exporting a repository. Nevertheless DMD_Git assumes that the SSH URL only needs to be used when a working copy is requested.
B. To remedy B. one could theoretically use an ssh URL for private repositories, unfortunately they are not supported at the moment - DMD_Git does not consider them valid.
C. DMD_Git assumes all SSH URLs all use the user "git" (they start with git@...) which doesn't need to be the case. This is not strictly a private repository related issue, but it plays into the solution we are going for here.

What's the envisioned solution for this problem?

Should we allow SSH URLs as download URLs? While this would not solve C, it would not perpetuate it.

For a more comprehensive solution: Should there be a separate 'export' and 'working copy' URL? Or a flag that allows for specifying the git user?

For testing, create a make file pointing to a private repository you have access to and execute it with and without --working-copy:

projects[my_private_project][type] = module
projects[my_private_project][download][type] = git
projects[my_private_project][download][url] = git://github.com/example/my_private_project.git
projects[my_private_project][download][branch] = master
CommentFileSizeAuthor
#1 864230-1_private_git.patch2.98 KBalex_b

Comments

alex_b’s picture

Status: Active » Needs review
StatusFileSize
new2.98 KB

This patch adds support for SSH URLs.

The diff is long, but all it adds is an if/else statement that wraps the switch() statement in DMD_Git::download() into its second branch:

if (empty($url_array['protocol'])) {
  // If protocol is not given, assume an SSH URL.
  $url = $download['url'];
}
else {
  switch ($url_array['protocol']) {

The modus operandi of this approach is that whenever a private repository is to be referenced, it needs to be done so by using an SSH URL:

projects[my_private_project][type] = module
projects[my_private_project][download][type] = git
projects[my_private_project][download][url] = git@github.com:example/my_private_project.git
projects[my_private_project][download][branch] = master
langworthy’s picture

Using the latest version of drush and drush make some of our make files which use SSH URL's (and previously worked) stopped working. The error was "unknown protocol in ". Using the --verbose flag revealed further information including Undefined variable: name drush_make.download.inc:355

This patch works great.

jrbeeman’s picture

Patch worked great for me too!

dmitrig01’s picture

putting on my "tomorrow morning" list

psynaptic’s picture

Works for me :)

dmitrig01’s picture

Status: Needs review » Fixed
dmitrig01’s picture

btw sorry for the wait :/

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.