Saturday, February 1, 2014

No Prompt Google Code Credentials for Git

I'm trying to push my latest and greatest git repo to google code and I fat fingered the user/password. Now forever I get

git push --all googlecode

fatal: remote error: Invalid username/password.

Now it won't prompt me again for the credentials and I can't figure out how to get it to forget what I entered already. I tried to remote and add the remote repo but still it remembers. 

The solution is to create a .netrc file and place in your home directory. The googlecode link https://code.google.com/hosting/settings provides the content for .netrc

Should look something like

machine code.google.com login your-google-email@gmail.com password kasdlkjflskj





Converting Googlecode repo from Subversion to Git

I figured this would be simple. Following the instructions I wind up with an error on the git svn command

ceylon:dev andrew$ git svn clone --stdlayout http://myproject.googlecode.com/svn/  myproject
Can't locate SVN/Core.pm in @INC (@INC contains: /usr/local/git/lib/perl5/site_perl/5.16.2/darwin-thread-multi-2level /usr/local/git/lib/perl5/site_perl/5.16.2 /usr/local/git/lib/perl5/site_perl /Library/Perl/5.16/darwin-thread-multi-2level /Library/Perl/5.16 /Network/Library/Perl/5.16/darwin-thread-multi-2level /Network/Library/Perl/5.16 /Library/Perl/Updates/5.16.2 /System/Library/Perl/5.16/darwin-thread-multi-2level /System/Library/Perl/5.16 /System/Library/Perl/Extras/5.16/darwin-thread-multi-2level /System/Library/Perl/Extras/5.16 .) at /usr/local/git/lib/perl5/site_perl/Git/SVN/Utils.pm line 6.
BEGIN failed--compilation aborted at /usr/local/git/lib/perl5/site_perl/Git/SVN/Utils.pm line 6.
Compilation failed in require at /usr/local/git/lib/perl5/site_perl/Git/SVN.pm line 26.
BEGIN failed--compilation aborted at /usr/local/git/lib/perl5/site_perl/Git/SVN.pm line 33.
Compilation failed in require at /usr/local/git/libexec/git-core/git-svn line 25.

BEGIN failed--compilation aborted at /usr/local/git/libexec/git-core/git-svn line 25.

After some poking around I realized I had to disable the version of Git that comes with Xcode due to some incompatible something or other. So I did

sudo mv /usr/bin/git /usr/bin/git-xcode

And installed git from http://git-scm.com/download/mac

So, apparently this git install isn't 100% awesome. To convert my repository I need to use Xcode git, so

/usr/bin/git-xcode svn clone --stdlayout http://myproject.googlecode.com/svn/  myproject

This works, yay!


Tuesday, December 24, 2013

Time Machine on Raspberry Pi

I like not losing data just like everyone else. I had been using an old 200GB USB hard drive for Time Machine and this worked well until I upgraded my mac. In anticipation of greater data needs I purchased a Rosewill $20 SATA USB hard drive enclosure and a 2TB hard drive. I opted for the cheaper USB 2.0 since USB 3.0 is not supported by the Pi. I found lots of guides that describe how to configure Time Machine on the RPi, but this one by danb35 was the most concise.

Of course a huge advantage of a networked Time Machine (aka Time Capsule) is you don't need to be plugged in, and you don't need to even think about it. I'm not going to duplicate Dan's excellent guide but instead provide commentary. The apt-get upgrade took quite a while, > 1 hour, but I'm not sure exactly since I gave up and went to bed. I guess I had fallen a bit behind on updates.

The gparted application requires a UI. I have a monitor/keyboard for the RPi but didn't want to monkey around with the keyboard/mouse/hdmi nonsense so instead I connected via an X Window session, only this didn't not work. I tried ssh -X pi@host and lxsession but nothing happened. Turns out you need to install xquartz. I found it a bit odd that this wasn't mentioned by the vast majority of posts on the forum.



Now I could connect and launch gparted (from the start menu under "preferences"). With gparted I deleted the existing partitions and created two partitions (timemachine and data). This is a 2TB drive and while I read that the ideal Time Machine drive size is 2-3x your hard drive size, I went with a slightly smaller 1TB. I chose ext4 for the filesystem. I figured that since Google picked ext4, and Google knows a thing or two about filesystems, it's probably a safe bet. At first I tried resizing the existing partitions but quickly realized this was a horrible idea as it was copying byte-by-byte useless data from one partition to another. I went through a few iterations with gparted and found gparted worked best when I applied changes after each change (ie not batching). With multiple partitions you should have an sda1 and sda2; take note of this when mounting drives. Oh and I just ignored the "Daemon is inhibited" error.

As others have noted, the appending to fstab results in a permissions error so instead sudo with vi or nano and append the line. At some point during the installation the permissions to the mount got whacked so I again ran sudo chmod 777 /mnt/timemachine/

Then, I created a user for Time Machine:

useradd timemachine
passwd timemachine

Now under Time Machine preferences, select disk, I see the raspberry pi disk. I did the initial backup via ethernet and it took about 10 hours for 144GB.



I have an old dell desktop which I could just have easily used for Time Machine but it consumes about 70W and makes lots of unpleasant whirring noises. The RPi and USB hard drive only uses about 8-9 watts, as measured with my kill-a-watt! Of course the hard drive uses the lions share of power, about 7 watts.

So far I'm quite pleased with this setup. The total cost came to a very reasonable $102 ($40 Pi + $20 USB + *$30 HD + $12 SD Card/Power *I got a super deal on the hard drive). The setup could have been about 20 minutes but I spent about an hour, most of which was spent figuring out the X Window snag.