M. Petersen M. Petersen - 1 year ago 206
Git Question

What does git -H do?

I am working with this command:

sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production

and I am the root user so I should be able to also use the command without sudo but Linux says to me after I used the command without sudo that -H is a unknown option.

Answer Source

It's not git -H, it's an option to sudo. Read this as:

sudo         // This is what we're running
-u git       // Run the command specified later as user "git"
-H bundle    // Set the HOME environment variable to that of user "bundle"
exec rake gitlab:backup:create // The command to execute

If sudo is complaining that it doesn't know what -H means, that may mean you have an old version of sudo that doesn't support it, or that your flavour of sudo uses a different command line option for the same behaviour. I'd suggest checking for updates, and then using man sudo to check for the exact version you're running locally and which options it accepts.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download