Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialShen JIE LIN
10,612 PointsGetting SSH for Windows OS
So I am following along with installing Laravel, and the tutorial is mainly done in Mac OS, but I am using Windows 7.
I didn't think it would be much of a problem, but however, I ran into problems.
first of all, I don't have an SSH key, and following the link provided to me on GitHub Guide to SSH, I got as far as of
Enter file in which to save the key <//.ssh/id_rsa>:
the guide told me to press enter, so I just pressed enter without typing anything
then it gave me the following error message
" Could not create directory '//.ssh'. "
I did some search on getting ssh key for windows, and some guide talked about getting Cygwin.
Do I have to get Cygwin? is there a good guide I can refer to for getting an SSH key for Windows?
Thanks
UPDATE
I am able to get pass that step now by not just pressing enter, but rather typing the "id_rsa" and then pressing enter.
and I have found out that Cygwin just provides shell scripting capabilities and some other functions which I didn't bother to learn at this time
However, when I am at the "clip < //.ssh/id_rsa.pub" stage, it tells me "The network path was not found"
so I kind of need help from this point on now.
2 Answers
Chris Shaw
26,676 PointsHi Shen,
When it comes to Windows everything to do with shell commands is difficult, I have found however that you can use the built in Windows command prompt to run SSH commands if you which makes it easier as you then don't have to run 2 separate command windows.
I did the following
- Close all
cmd
andcygwin
windows that are open - Download GIT from http://git-scm.com/
- During the installation make sure to choose
Use GIT from the Windows Command Prompt
andUse OpenSSH
- Next I added the
bin
directory to my Windows environment variablesPATH
value;C:\Program Files (x86)\Git\bin;
- Restart your PC, sometimes you can get away with not needing too
If you don't know how to edit the Windows PATH
variable see the following link. http://www.java.com/en/download/help/path.xml
Once you have all that setup open the Git GUI and in the help menu click Show SSH key
, if you don't already have one you can generate one right there and then otherwise it will show your public key in the box.
Setting up Homestead
The biggest difference in Windows is you don't have the same path structure as unix systems which means we need to use absolute paths, in my case my user folder is named chris
therefore my SSH key path will be.
C:/Users/chris/.ssh/id_rsa.pub
The same goes for the map
keys that require directory paths however you can use unix paths for to
as they are relative to the laravel
home folder that comes on the Homestead box by default.
Dragos Dehelean
4,636 PointsI'm also a Windows 10 user and I had the same problem. Eventually, it was the virtualization technology that wasn't enabled in BIOS. I searched for instructions on how to enable it and in the end, after rebooting and reinstalling Homestead, it was ok.
Laravel has also a warning about this:
"If you are using Windows, you may need to enable hardware virtualization (VT-x). It can usually be enabled via your BIOS. If you are using Hyper-V on a UEFI system you may additionally need to disable Hyper-V in order to access VT-x."
Shen JIE LIN
10,612 PointsShen JIE LIN
10,612 PointsAfter so many struggles I finally got to the step of 'Vagrant Up'
and now while the vagrant is trying to access 127.0.0.1:2222 using vagrant as username and a private SSH, it keeps on giving me Warning: Connection timeout. Retrying...
This is so frustrating lol
Chris Shaw
26,676 PointsChris Shaw
26,676 PointsTypically this happens if the VM hasn't fully started yet, if it does it over and over an additional error should occur 1-2 minutes later which would mean that you either don't have your processors virtualization technology isn't enabled in the BIOS or a critical error is keeping the VM from starting.
Shen JIE LIN
10,612 PointsShen JIE LIN
10,612 PointsHey, Chris I'd like to first thank you for spending your time to help me.
continuing on with this topic, I think my virtualization technology should be enabled, since the treehouse VM is wokring properly on my machine.
I have did some more search and someone said that maybe firewall is preventing the VM from working properly, or maybe the machine is just simply loaded with too many programs so the VM cannot get started in time.
I have tried to disable my firewall, and also determined that my machine is not too heavy
Maybe I should talk about my setup a little bit and see if there is anything wrong with that
below is my yaml file setup, maybe the problem is within there?
ip: "192.168.10.10" memory: 2048 cpus: 1
authorize: C:.ssh\id_rsa.pub
keys: - C:.ssh\id_rsa
folders: - map: C:\Software\Homestead\Projects to: C:\HashiCorp\Vagrant\Sites\Sites
sites: - map: laravel.dev to: C:\HashiCorp\Vagrant\Sites\laravel-basics\public
variables: - key: APP_ENV value: local
Chris Shaw
26,676 PointsChris Shaw
26,676 PointsYour configuration has a few issues mainly around the folder paths, see the below and make sure to replace
<username here>
where your username.As I said earlier on the
to
mapping paths are related to the VM itself so you need to use unix paths.Shen JIE LIN
10,612 PointsShen JIE LIN
10,612 PointsI have reconfigured everything again, as well as reset up the Homestead to be under my user here is the new yaml file config
However, I am still having the timeout problem
ip: "192.168.10.10" memory: 2048 cpus: 1
authorize: C:\Users\Truc-Lin.ssh\id_rsa.pub
keys: - C:\Users\Truc-Lin.ssh/id_rsa
folders: - map: C:\Users\Truc-Lin\Homestead\Projects to: /home/vagrant/Sites
sites: - map: laravel.dev to: /home/vagrant/Sites/laravel-basics/public
variables: - key: APP_ENV value: local
Shen JIE LIN
10,612 PointsShen JIE LIN
10,612 PointsI should mention that I did not have the .ssh directory, therefore I manually created it with "mkdir .ssh"
and then inside the the self created ".ssh" I ran the command ssh-keygen -t rsa -C "your@email.com" with my email address
after I ran that I got a "id_rsa" and "id_rsa.pub" file, however I don't have a file called "known_hosts" like in the tutorial video by treehouse.
Shen JIE LIN
10,612 PointsShen JIE LIN
10,612 PointsI tried the GitHub method
ssh-agent -s
but when I ran this below command ssh-add C:\users[my-username].ssh\id_rsa
it gave me "could not open connection to your authetication agent" I guess this is my problem right here
Shen JIE LIN
10,612 PointsShen JIE LIN
10,612 Pointslatest update...
so I have used the GitHub method to get my new SSH key, and I have the known_hosts file now in my .ssh directory.
However, when I run "vagrant up" , I am still stuck at the timeout problem, =/
2 days of trying to set up this laravel framework with no success is so frustrating... sorry that you have to hear my complaints, Chris...
I have found some further posts saying that laravel homestead does not work properly with 64bit, not sure if that is true... or not...
Chris Shaw
26,676 PointsChris Shaw
26,676 PointsSorry for the delay, the above config you posted above still has some issues with it.
Shen JIE LIN
10,612 PointsShen JIE LIN
10,612 PointsHey, Chris
Thank you for all the help and time that you have provided with me here, in the end I switched to Mac OS, and the set up took, like 10 minutes with no complications.
however, I still learned a lot from you.
I guess The lesson here is just that, I just gotta learn to develop both in Mac and Windows OS. lol
Thanks again
Chris Shaw
26,676 PointsChris Shaw
26,676 PointsYou're very welcome, I'm happy that you finally got setup and going, OS X is very easy to get set up on because everything you need such as SSH is already there and works out of the box.
In my experience learning both is a great choice to make as it allows you to understand problems like this where an operating system like OS X is much easier to use compared to Windows.