Wednesday, January 22, 2014

Git configuration with Bitbuket

Bitbuket.org an implementation of git.
It provide you a private repository with free of cost up to 5 user access.

Requirement:
  1. Git software Download and install msysgit from here.
  2. An account in bitbuket

Step to simple project setup:
→ Open git-bash software
Check .ssh folder created at your user folder [$ssh -v]

Generating public/private rsa key pair [$ssh-keygen]
Create config file in your .ssh folder
paste the following
Host bitbucket.org
 IdentityFile ~/.ssh/id_rsa
save it
Restart the terminal

Create .bashrc at root of your user home directory
paste the following scipt

SSH_ENV=$HOME/.ssh/environment
   
# start the ssh-agent
function start_agent {
    echo "Initializing new SSH agent..."
    # spawn ssh-agent
    /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
    echo succeeded
    chmod 600 "${SSH_ENV}"
    . "${SSH_ENV}" > /dev/null
    /usr/bin/ssh-add
}
   
if [ -f "${SSH_ENV}" ]; then
     . "${SSH_ENV}" > /dev/null
     ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
        start_agent;
    }
else
    start_agent;
fi


Save and close the file and reopen the git

Ssh add
$ ssh-add -l

Install the public key on your Bitbucket account

cat ~/.ssh/id_rsa.pub
Select and copy the key output in the clipboard.

Login to bitbuket account and goto manage account → sshkey tab (On the left side of page)
Add and save the key with suitable name.

create .gitconfig file in the root directory of  your user home and add the below in the file

[user]
    name = username
    email = registedgmail@xxx.com 
save and close
Return to the terminal window and verify your configuration by entering the following command

ssh -T git@bitbucket.org
The authenticity of host 'bitbucket.org (131.103.20.167)' can't be established.
press yes and it will create the configuration.
try again the
ssh -T git@bitbucket.org
Note : if you get your name printed in the terminal. You achieved it.


Merging two sorted arrays - Big O (n+m) time complexity

 Problem :  Merge the two sorted arrays. Edge case :  Array can empty Arrays can be in different size let getMaxLength = ( input1 , input...