Installing Rails Plugins with Git on Windows

Wednesday, August 27th, 2008...10:28 pm

Jump to Comments

Ok, so everyone is the rails world seems to have moved over to Git for their version control (which is fine if you’re into the sort of thing). The downside of this is that Windows developers are left without much help when they want to install all those fabulous plugins hosted on GitHub (since most Git users are on Linux and most Rails hackers are on Macs). Well, here’s the trick I just learnt:

Go read this introduction to Git on Windows and install the command-line package of msysgit. Now, if you’ve got Rails 2.1 or later you should be able to do

ruby script\plugin install git://github.com/thoughtbot/shoulda.git

but it will fail with various errors, probably including “Plugin Not Found”. Instead, try:

ruby script\plugin install http://github.com/thoughtbot/shoulda.git/

It’s annoying but it works. Of course, you could just use git to clone the plugin into the directory but then you have to actually install it and I found it just got messy.

Update: I noticed that with a new Rails project I didn’t have this issue and the first method works fine.  I’d upgraded the old pre-2.1 project but obviously something didn’t stick.  So another method might be to recreate the project.

15 Comments

  • I install shoulda plugin on Windows with the following command:

    ruby script/plugin install git://github.com/thoughtbot/shoulda.git –force

    and everything works fine.

    I hope that help you!

  • Thank you :)

    Just spent an hour trying to make msysgit work to get a valuable plugin Revisionary. Your little tip saved me hours more.

    My client on this project is a MS Windows agency 100%. They want their servers hooked into their domain, with their virus scanners and management tools installed. Ayup.

    Developers don’t determine development environments – clients do.

  • Thanks for the helpful article, I for one have no idea why git is better than svn, but going with the flow.

  • thanks!

    fyi, works with 2.0.2 as well
    the cygwin git version works like a charm as well

  • Thanks for the great info. Unfortunately I’m still having problems installing from github on Windows Vista. I’ve tried installing mysysgit multiple times with different settings and continue to get the same results.

    I run:
    ruby script\plugin install git://github.com/thoughtbot/shoulda.git

    and it seems to finish without errors.

    Unfortunately when I look in vendor/plugins/shoulda the directory is completely empty.

    Do I need to launch GIT and execute some commands before attempting to install the plugin?

    Thanks in advance. Great blog, great info.

  • @Kevin

    I just had the same problem on Vista, the key for me was to include the trailing slash as above. That made it so the directory had all the nice content you expect.

    Here is the command that worked for me on vista:

    ruby script/plugin install http://github.com/joshmh/globalize2
    .git/

    Thanks for the blog post! Saved my life on rails ( :

  • @Kevin – same problem
    @Tom – the trailing slash solved the trick. Thanks

  • Thanks a lot!! I didn’t even have to install msysgit. I just had to type “http://” instead of “git://” and add the “/” at the end.

    You saved my (non Heroku) Rails life.

  • How should I set up my proxy in Git? I think I can’t get it work as you described before because of that. So I installed ‘msysgit’. I browsed to my Rails app folder, thet right-clkicked on the projet and chosen ‘Git Bash here’; I entered in a command prompt window; I typed as you told: ruby script\plugin install http://github.com/technoweenie/attachment_fu.git. I got the following error: no such file or directory –scriptplugin. So tried like that: ruby script/plugin install http://github.com/technoweenie/attachment_fu.git. The error changed for: Plugin not found:[http://github.com/technoweenie/attachment_fu.git]. I tried like that:ruby script/plugin install git://github.com/technoweenie/attachment_fu.git. The error changed for:

    Initialized empty Git repository in C:/Documents and Settings/e134276/My Documents/Rails projects/up
    load_files/vendor/plugins/attachment_fu/.git/
    github.com[0: 65.74.177.129]: errno=No such file or directory
    fatal: unable to connect a socket (No such file or directory)
    Any idea how to get it work, please ?

  • I am working on a win2k8 machine and had the same problem. If all you care about is installing the plugin just download the plugin manually rename it to restful_authentication and copy into your vendors/plugin directory.

    Proceed with scripts/generate user sessions

    should work.

  • OMG, thanks a lot!

    I spent so much time to search for a solution before finding this post.
    S**t, people have to start documenting things better!

  • Please please please help!

    I got it to work once, but now when I type that line in the windows command prompt, it just says “ruby: No such file or directory — script/plugin (LoadError)”

    What am I doing wrong here?

  • @Hunts make sure you’re executing the “ruby script/plugin” command from the root of your application workspace

  • Hi, I have a problem, script/plugin install svn://… not working on windows XP and rails 2.3. How to do this ? please help me

  • Thank you SOOOOOO much, this was driving me crazy on my windows machine. Again I needed to use http: and the trailing / to get it to work, previously was just a blank folder.

Leave a Reply