Setting up git + github

480 views
Skip to first unread message

Dr Nic Williams

unread,
Jan 17, 2011, 12:51:52 PM1/17/11
to railsin...@googlegroups.com
RailsInstaller 1.0 comes with Git. In the initial release though you will need to setup your git config manually, create SSH keys manually, and upload them to GitHub (or wherever) manually. Here's the steps I use, and hopefully they are useful:

I'm in a Windows 7 VM on VirtualBox; using a new user account "Dr Nic". I have RailsInstaller installed in C:\RailsInstaller.

Setup git:

> git config --global user.name "Your Name"
> git config --global user.email "your_...@whatever.com"
> git config --global core.autocrlf true
> git config --global core.safecrlf true

(these instructions come from http://gitimmersion.com/lab_01.html)

To generate your ssh key (required by Github, Engine Yard AppCloud, etc to access some services):

> mkdir "%homedrive%%homepath%\.ssh"
> c:\RailsInstaller\Git\bin\ssh-keygen.exe -f "%homedrive%%homepath%\.ssh\id_rsa" -t rsa -N ""

To copy your public ssh key into your clipboard:

> cat "%homedrive%%homepath%\.ssh\id_rsa.pub" | clip

Now you can paste it into Github (https://github.com/account), Engine Yard AppCloud dashboard (https://cloud.engineyard.com/keypairs), etc as required.

Cheers
Nic


Dr Nic Williams

unread,
Jan 17, 2011, 1:44:36 PM1/17/11
to railsin...@googlegroups.com
Ooh, %USERPROFILE% is much nicer single variable.

Luis Lavena

unread,
Jan 17, 2011, 1:50:30 PM1/17/11
to railsin...@googlegroups.com
On Mon, Jan 17, 2011 at 3:44 PM, Dr Nic Williams <dr...@engineyard.com> wrote:
> Ooh, %USERPROFILE% is much nicer single variable.

I solve that doing SET HOME=%HOMEDRIVE%%HOMEPATH%

I grew on a limited corporate environment and my home directory was a
network share.

USERPROFILE is used by Windows to store part of users profile
configuration and under certain stations the user profile is roamed
into the server.

But the sync is not instant, so if I switch computers didn't get my
modifications.

That is why I learnt to use HOMEDRIVE+HOMEPATH and that is what Ruby
also prefers first than USERPROFILE.

Here is a list of what each one of these variables are used for:

http://en.wikipedia.org/wiki/Environment_variable

--
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

Wayne E. Seguin

unread,
Jan 17, 2011, 2:18:28 PM1/17/11
to railsin...@googlegroups.com
SET HOME=%HOMEDRIVE%%HOMEPATH%

wow, this is a very useful and good to know trick Luis, thanks for that!!!


Dr Nic Williams

unread,
Jan 17, 2011, 2:22:13 PM1/17/11
to railsin...@googlegroups.com
Luis, thoughts on RailsInstaller setting that up for users, if HOME isn't already set? I'll create a ticket for it. ENV['HOME'] is definitely looked for by many RubyGems as the user's home folder.

Nic
--
Dr Nic Williams
Engine Yard, VP Technology

Luis Lavena

unread,
Jan 17, 2011, 2:54:04 PM1/17/11
to railsin...@googlegroups.com
On Mon, Jan 17, 2011 at 4:22 PM, Dr Nic Williams
<nwil...@engineyard.com> wrote:
> Luis, thoughts on RailsInstaller setting that up for users, if HOME isn't
> already set?

Yeah, good idea.

Ruby 1.8 explode when you do File.expand_path("~") without HOME being set.
(fixed in 1.9.1 and 1.9.2)

> I'll create a ticket for it. ENV['HOME'] is definitely looked
> for by many RubyGems as the user's home folder.

I most of the times recommend users do it manually, for several reasons:

So they know how to do it.
So it is clear why is needed.

But educational practices have been failing lately in the Windows
area, so automate might be a good option.

Gayle Craig

unread,
Jan 18, 2011, 10:16:55 PM1/18/11
to RailsInstaller
Maybe off topic a bit, but is that at all related to why apps
generated w/ Rails 2 does
require File.join(File.dirname(__FILE__), 'boot')
in environment.rb?

and apps generated w/ Rails 3 have
require File.expand_path('../boot', __FILE__)
in application.rb?

I'm not talking about the fact that one is in environment.rb and the
other is in application.rb, I was able to follow that thru. The point
being the use of .dirname vs. .expand_path. Took me awhile to figure
out some issues related to that when trying to upgrade an existing app
from Rails 2 to 3. Just wondered. Ignore me if it's too off topic
for this thread.

Dr Nic Williams

unread,
Jan 31, 2011, 7:32:19 PM1/31/11
to railsin...@googlegroups.com
Update - I'm working on generating the ssh keys automatically. I'm probably going to script uploading of SSH keys via the github gem.

Nic

Owen Dall

unread,
Jan 31, 2011, 9:24:19 PM1/31/11
to railsin...@googlegroups.com
Awesome. Another pain point for newbies to bite the dust.

(Sent from my iPad)
...............................
Owen Dall
Chief Systems Architect
Barquin International
Cell: 410.991.0811

Reply all
Reply to author
Forward
0 new messages