Drush Version: 8.1.7
git version: 2.10.1
I have a module (that I maintain) that I'd like to use drush rn with. Previously this worked fine but after some updates (its been a few months so there are all sorts of updates, system, drush etc) I'm now seeing this:
drush rn
fatal: Not a git repository (or any of the parent directories): .git is not a valid Git tag.
Or:
drush rn 8.x-2.4
8.x-2.4 is not a valid Git tag.
8.x-2.4 is a valid git tag:
git tag
8.x-2.1
8.x-2.2
8.x-2.3
8.x-2.4
I've tried with both versions of the module 8.x and 7.x versions. Any ideas?
Workaround
Just specify the @none Drush site alias, e.g., drush @none rn.
Comments
Comment #2
tancIf I clone my module to a location outside of a Drupal project then it works fine.
Comment #3
nickdickinsonwildeJust ran into this, and can confirm running outside of a drupal dir works fine. Haven't debugged at all yet but identical results.
Comment #4
benjy commentedAlso ran into this same issue, moving the repo outside of Drupal worked for me.
Comment #5
meickolsame here, subscribing
Comment #6
berdirThis might be a bug in Drush 9, my guess is that you're on that version.
https://github.com/drush-ops/drush/issues/2774
Comment #7
tancHi Berdir, I'm on drush 8.1.9 now (8.1.7 when initially reported).
Comment #8
berdirHm, ok, maybe 8.1 is also already not working anymore or 8.
If you change
chdir(getcwd()); // Make sure we're in the working directory started.
to
chdir(drush_cwd()); // Make sure we're in the working directory started.
does it still not work? because with drush 9, not even that works and that should according to the documentation.
Comment #9
moshe weitzman commentedI haven't researched, but the expected behavior is to change to drupal root when a drupal site is present. I suggest that this script should use drush_shell_cd_and_exec() and specify its working dir so it is control of directory when run.
Comment #10
berdirright I saw that helper function that would indeed be cleaner. But the first problem is that I didn't manage to get the correct working dir because drush_cwd() did not work as I think it should.
That's mentioned in https://github.com/drush-ops/drush/issues/1125 for example, but I'm not seeing the ouptut that is mentioned there.
Comment #11
moshe weitzman commentedTo be honest, that function relies on being called early in preflight and it may not be anymore. This should work for you:
Comment #12
berdirYeah, something like that was my guess, it not being initialized anymore.
The getenv() doesn't seem to be workig either, though:
.../d8/modules/tmgmt_mygengo(8.x-1.x)$ drush ev "var_dump(getenv('PWD'))"
string(24) ".../d8"
Comment #13
moshe weitzman commentedIts working for me. I tried it before suggesting:
~/reps/watchers/web/modules/contrib/flag $ drush eval "print getenv('PWD')"
/Users/moshe.weitzman/reps/watchers/web/modules/contrib/flag
I'm using latest Drush9. I succeeded with both PHP 5.6 and 7.0.
Comment #14
mpp commentedIt only seems to work properly when calling the local drush binary:
drushwill always return the webroot vs../vendor/bin/drushwill indeed return the path to the cwd.Comment #15
traviscarden commentedIt works for me if I just
drush @none rn. Is there a way to force the command to always use@none?