Monday, 15 February 2016

Git push asking for username and password

When I try to push the code to github, I need to submit username and password every time. I keep on asking for username and password while pushing the code.

I came to see its due to ssh.

I have checked my remote config of my git repo and came to see it was with https

>    git remote –v
Now I removed the remote repo which is with https as below
>    git remote rm origin

Now I added the remote repo with git as below
>    git remote add origin git@github.com:umamahesh/sampleapp.git

Now authentication happens without ssh and with keys. You can push the code without username and password.

Thank You,
Uma Mahesh.

get code from remote branch in git

When you want to pull the branch code from same  repo, first navigate to main branch. Main branch is the reference branch.

>     git checkout master

From the main branch checkout to ‘develop’ branch. Develop branch is the name of the remote branch I am referring to.
>    git checkout develop
>    git pull origin develop
Now you will get the latest code from develop branch.

Below are the steps to merge the code from your branch to develop branch.

Let’s suppose you are working on the branch ‘uma-development’, Now you want to merge your code to ‘develop’ branch.

>    git checkout uma-development
>    git rebase develop

you may see many conflicts while doing the rebase. Try to solve conflicts one by one… after solving the conflicts, do git add
>    git add.
>    git rebase –continue

once your conflicts got resolved you are done with rebase. Now your branch ‘uma-development ‘ is up to date with develop branch code.

Now push the code to develop branch in remote and then raise pull request to develop branch.




Thanks,
Uma Mahesh.