Skip to content

Commit

Permalink
Make the .git/safe directory in bin/setup
Browse files Browse the repository at this point in the history
Assuming the binstubs for a project are in the local `bin/` directory,
we can add the directory to shell `$PATH` so that `rspec` can be invoked
without the `bin/` prefix:

    export PATH="./bin:$PATH"

Doing so on a system that other people have write access to (such as a
shared host) is a security risk:

rbenv/rbenv#309

The `.git/safe` convention addresses the security problem:

https://twitter.com/tpope/status/165631968996900865

I used to do this manually before, as I have it in my `$PATH`
https://github.com/mehlah/dotfiles/blob/master/zshenv#L12-13
  • Loading branch information
Mehdi Lahmam committed Jul 13, 2015
1 parent 7701aae commit 21e3a5d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions templates/bin_setup.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ fi
# Set up the database
bundle exec rake db:setup

# Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
mkdir -p .git/safe

# Pick a port for Foreman
if ! grep --quiet --no-messages --fixed-strings 'port' .foreman; then
printf 'port: <%= config[:port_number] %>\n' >> .foreman
Expand Down

0 comments on commit 21e3a5d

Please sign in to comment.