Git via SSH Asking For Your Password

The Issue

Few days ago, I was trying to git pull origin master from our master branch so I can get the latest version to develop on. Upon entering the command, this blankly (and blinkally) stared at me:

My-MacBook-Pro:branch_name loop$ git pull origin master
git@domain's password:

For the life of me, I have never seen this before. This particular branch worked fine just six days ago! 

I tried various things:

  1. Restarting com.openssh.sshd

  2. Restarting org.openbsd.ssh-agent

  3. Made sure that my public key on Gitlab is the same as my github_rsa.pub, and it indeed was the same.

  4. Uncommented sshd_config's to PasswordAuthentication no

  5. Checked /var/log/authd.log for errors relating to SSH, but nothing relevant came up

None of those fixes helped.

For some reason, Git stopped recognizing my public and private key (which was originally named github_rsa.pub and github_rsa respectively).

Eventually, I broke my silence, and my lovely French coworker Allan told me there's an easy fix - generate a new public/private key pair just for Gitlab.

The Fix

  1. In your favorite command line interface, generate a new SSH key:
    ssh-keygen -t rsa -C "name@domain.com"
    Note: For this scenario, when it prompted me to enter a password, I left it blank, since this key is simply for internal use.
  2. Dump the contents:
    cat ~/.ssh/id_rsa.pub
    
  3. Finally, copy the contents and add to Gitlab.

Pretty simple stuff. Let me know if this helped you in anyway - it seems this issue is quite common with Gitlab.

Resolving Vagrant and VirtualBox "Waiting for VM to Boot" Issue

The Issue

The company I currently work for uses Vagrant (which is awesome) to distribute standardized virtual testing environments. Vagrant is great.. Except when it doesn't work (which is not awesome).

I was a victim of the pretty notorious "waiting for VM to boot" issue that plagued certain configurations/versions of Vagrant. A little example of the help threads out there:

 "Failed to connect VM" issues. Yeah, I tried every single one and more.

"Failed to connect VM" issues. Yeah, I tried every single one and more.

The Fix

I was able to (finally) get the VM to boot.

  1. Boot your VM using the VirtualBox GUI (through either Vagrantfile boot-GUI command, or starting your VM using VirtualBox). Login using "vagrant" and "vagrant" when prompted.

  2. Within the GUI, manually start dhclient using "sudo dhclient eth0 -v". Why is it off by default? I have no idea. I found out that it was off when I tried to "wget" the "private/public keys" in the tutorial above, but was unable to.

  3. Setup your private/public keys using the link provided. My box is a "Debian Linux 3.2.0-4-amd64", so instead of: "/root/.ssh/id_rsa.pub", you have to use "/home/vagrant/.ssh/id_rsa.pub" (and the respective "id_rsa" path for the private key).

    Note: make sure your files have the right permissions. Check using "ls -l path", and change using permissions "chmod". Your machine may not have "/home/vagrant/.ssh/authorized_keys", so create that file with "touch /home/vagrant/.ssh/authorized_keys".

  4. Go to your local machine's command line and reload vagrant using "vagrant reload". It should boot, and no longer hang at "Waiting for VM to Boot."

Let me know if this works for you.