Posts

Showing posts with the label Git

How to create ssh-rsa key or id_rsa key for first time in git?

Your first time with git and github Get a   github   account. Download and install   git. Set up git with your user name and email. Open a terminal/shell and type: $ git config --global user.name "Your name here" $ git config --global user.email "your_email@example.com" Run this command to create keygen $ ssh-keygen -t rsa -C "your_email@example.com" Run this command to print the rsa key and you can copy this key manually $ cat < ~/.ssh/id_rsa.pub Paste your ssh public key into your github account settings. Go to your github   Account Settings Click “SSH Keys” on the left. Click “Add SSH Key” on the right. Add a label (like “My laptop”) and paste the public key into the big text box. Done

Git commands for a beginner

Git commands for a beginner if you are beginner in git environment then you should know that git provides you a way to update the file and move you file from local server to live server with command line Like a beginner   you have installed git on your server and setup the git account and ready to use git Now here is the problem begin where to start and how to use command Like you can check in which branch you are working Example: server-localhost( master ): So master is your current branch Now you made some changes in file and you want to push it on live server So keep in mind before push any code on live server you need run pull command on same branch after changes you need you pull file from server Example: git pull origin master This command will fetch update file from live server to your local server but will not change your changes in files Now you need to add your changes on git run command to add all changed file to add in git queue git add . This command wi

How to merge two branches in GIT?

Merge two branches in GIT Some it makes confuse us that how can i merge the branches in GIT when we have two branches in GIT Let say there are two branches on GIT one is master and second is develop And you are changing the code develop branch finish you code Now you want to merge the code with master So first of all you need to go to master branch because this is the branch which you want to merge with new code So first command you will run git checkout master N ow you can see that you are in master branch Now run second command to merge both of branch git merge develop This command will merge both of branches in one now master has same code as develop Now you need to run commit command with message git commit -m "merge two branches in git" Now push the changes on your master branch to update the code on server git push origin master Its done and it simple to merge two branches. Note: Keep in mind that master branch does

How to set up existing existing website to git?

If your site is already existing and you want to setup your site on  git. SO please follow the steps as shown below. 1) Go to the main directory where you site root Like: cd var/www/host/yousite cd <localdir>   2) run these command git init git add . git commit -m 'My first commit message on git' git remote add origin <Clone Url> git push -u origin master   Note: Your Clone Url can be like this git@bitbucket.org:yousitedirecoty/sitename.git Or it could be like this to git clone https://github.com/CompanyName/AppName   Now you can check you commit status on your git site. Please comment if this works!