Friday, August 22, 2014

Solidarity with the children of Gaza

In case you want to help stitch together the children that the Israeli "Defense" Force have so surgically torn apart, you can send money to:

Account details:


Account Name:  Bethlehem Arab Society for Rehabilitation
Account No. 1101-024285-111
IBAN: FR76 1797 9000 0100 0242 8511 172

Bank details:

Europe Arab Bank plc
26, Avenue des Champs E’lyse’es
75365 Paris Cedex 08
Tel: 33 1 45 61 60 00
Fax: 33 1 42 89 09 78
Swift: ARABFRPP



I have just sent 200 CHF...

Wednesday, August 20, 2014

Git, configuring SSH on Windows

a great feature of git ssh is that, when it fails, you are left with very vague error messages that can point to 1000s of different causes. It could hardly stink more. Really only for the expert.


git and ssh, two skunks



c:\pierre>git clone ssh://git@stash.acme.com:7999/pup/puppet-pippov2.git
Cloning into 'puppet-pippov2'...
Could not create directory '/c/WINDOWS/system32/config/systemprofile/.ssh'.
The authenticity of host '[stash.acme.com]:7999 ([10.56.8.198]:7999)' can't be established.
RSA key fingerprint is fb:09:c7:a7:79:07:99:35:3a:88:51:18:59:a6:8e:75.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/c/WINDOWS/system32/config/systemprofile/.ssh/known_hosts).
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.


I really have no clue where this systemprofile is coming from... must be some Windows default...

c:\pierre>echo %userprofile%
C:\Users\Pierluigi

c:\pierre>echo %HOME%
C:\WINDOWS\system32\config\systemprofile


Aha, see: the %HOME% variable is set to something WRONG.
I tried EXPLICITLY setting the %HOME% variable as a SYSTEM environment property (not a USER.... it didn't work....):
c:\pierre\vagrant>echo %HOME%
C:\Users\Pierluigi\

Now it all works. It can create the known_hosts file.
Windows stinks.

Git feature branch

More and more we are using "feature branch" rather than committing directly to master.

http://martinfowler.com/bliki/FeatureBranch.html

First, let's verify on which branch we are:
git checkout
Your branch is up-to-date with 'origin/master'.

and which branches are available in the current repo:
git branch
* master

it doesn't hurt to explicitly make sure we are on master:
git checkout master
Already on 'master'
Your branch is up-to-date with 'origin/master'.


and if needed, let's get the latest from the central repo:

git pull --rebase

we can now create a branch:

git checkout -b feature/pippo

and make sure the branch is actually created:

git branch
* feature/pippo
master


since I am paranoid, I again switch to this new branch:

git checkout feature/pippo
Already on 'feature/pippo'


I create a file:

echo ciao > ciao.txt

and

git add ciao.txt

and commit

git commit -m "added ciao"

if you switch to "master", ciao.txt disappears, because it's only in the "feature/pippo" branch:

git checkout master

ciao.txt is gone!

git checkout feature/pippo

ciao.txt is there again!



Now we need to push the branch to the central repo:

git push
fatal: The current branch feature/pippo has no upstream branch.
To push the current branch and set the remote as upstream, use

git push --set-upstream origin feature/pippo


you can simply do:
git push -u origin HEAD
Counting objects: 6, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 273 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To ssh://git@stash.acme.com:7999/gs/playgroup.git
 * [new branch]      HEAD -> feature/pippo
Branch feature/pippo set up to track remote branch feature/pippo from origin.


How to promote to master the changes in "feature/pippo" ? With a pull request, followed by a code review and a test! In github or stash you can create the pull request using the UI. This is a very cool and organized way to include changes to the master branch in a controlled, "atomic" way - a whole branch is a unit of changes that can be excluded as a whole if needed.