koyekola

Force SSH key authentication for a specific group

Imagining that you have some users that have sudo capabilities on your server, you probably want to use a more secure connection for them by disabling password authentication.

To do that, first make all those users part of a group (admin in this example). Then add the following directive to your /etc/ssh/sshd_config file and restart ssh (/etc/init.d/ssh restart)

Match Group admin
PasswordAuthentication no
ChallengeResponseAuthentication no

pip error installing from git branch/tag [FIXED]

For some time now I’ve had an issue on my local machine with pip installing from git repositories at a specific branch or tag (pip install git+git_repo_url@branch#egg=eggname). I kept on getting the following error:

$ pip install -e git+git://github.com/simplegeo/python-oauth2.git@hudson-python-oauth2-147#egg=python-oauth2
Obtaining python-oauth2 from git+git://github.com/simplegeo/python-oauth2.git@hudson-python-oauth2-147#egg=python-oauth2
  Updating ./.virtualenvs/cenper/src/python-oauth2 clone (to hudson-python-oauth2-147)
  Complete output from command /usr/local/bin/git rev-parse origin/HEAD:
  fatal: ambiguous argument 'origin/HEAD': unknown revision or path not in the working tree.

Use '--' to separate paths from revisions

origin/HEAD

----------------------------------------
Command /usr/local/bin/git rev-parse origin/HEAD failed with error code 128
Storing complete log in /Users/nduthoit/.pip/pip.log

After some debugging into pip’s code for git I realized that the name of the branch had some strange stuff at the beginning and end of the actual branch name (origin/HEAD in this case):

ipdb> branch
'\x1b[31morigin/HEAD\x1b[m'

And no, that’s not unicode, it’s color code! The red output of the branch name in the error message should have been a clue.

The cause was my .gitconfig’s color setting:

[color]
        ui = always

I just had to set it to:

[color]
        ui = auto

And everything worked again!

Morale: don’t be shy of debugging and tracing errors that bug you.

More Information