(refs #490)Set HEAD ref when saved default branch

GitBucket allows user to configure default branch in the repository.
But it's only affect repository viewer in the GitBucekt world.
This change set default branch in the Git world.
Fix Warnings