After Installing Git in your Computer, Open an GitHub account with Username and Password.
In the Git bash, give the following command:
- Git Config:
Git config –user.email “email@example.com”
This command sets the author name and email address respectively to be used with your commits.
Do the following to create a new repository:
To create a new repository, give a repository name and initialize a readme file.
After creating a new repository called Property in git hub, Clone the repository into your local system.
Open a browser and a terminal window from your desktop. After opening the terminal window, do the following:
Navigate to your home (~) directory.
$ cd ~
As you use Github more, you will probably work in multiple repositories. For that reason, it’s a good idea to create a directory to contain all those repositories.
Create a directory to contain your repositories.
$ mkdir repos
From the terminal, update the directory you want to work in to your new repos directory.
$ cd ~/repos
From Github, go to your Property repository and select Clone this repository.
Github displays a pop-up clone dialog. By default, the clone dialog sets the protocol to HTTPS or SSH, depending on your settings.
Copy the highlighted clone command.
From your terminal window, paste the command you copied from Github and press Return.
In the git terminal, give the git clone command.
- Git clone [url]
List the contents of your repos directory and you should see your Property directory in it.
So, we successfully cloned your repository to your local repository.
Add a file to your local repository and put it on Github:
Go to your terminal window and navigate to the top level of your local repository.
Enter the following line into your terminal window to create a new file with content.
List all the file in Property directory by using command ls
Get the status of your local repository. The git status command tells you about how your project is progressing in comparison to your Github repository.
At this point, Git is aware that you created a new file, and you’ll see something like this:
The file is untracked, meaning that Git sees a file not part of a previous commit. The status output also shows you the next step: adding the file.
Tell Git to track your new
locations.txt file using the
git add command.
Just like when you created a file, the
git add command doesn’t return
anything when you enter it correctly.
git add command moves changes from the
working directory to the Git staging area. The staging area is where you
prepare a snapshot of a set of changes before committing them to the official
git commit command with a commit message, as
shown on the next line. The -m indicates that a commit message follows.
git commit takes the staged snapshot and commits
it to the project history. Combined with
this process defines the basic workflow for all Git users.
Up until this point, everything you have done is on your local system and invisible to your Github repository until you push those changes.
Go back to your local terminal window and send your committed changes to Github using
git push origin Master. This command specifies
that you are pushing to the master branch (the branch on Github) on origin (the
Your commits are now on the remote repository (origin).
Go to your Property repository on Github. If you click Commits in the sidebar, you’ll see a single commit on your repository. Github combines all the things you just did into that commit and shows it to you.
Pull changes from your Git repository on Github
Step 1. Create a file in Github
To add your new locations file, do the following:
- From your Property repository, click Source to open the source directory. Notice you only have two files, locations.txt and README in your directory.
Create a new file called Estate Agent and commit changes by commit Button.
So new file is formed in Property Repository. You need to pull that file to the local repository by doing following:
1.Open your terminal window and navigate to the top level repository.
2.Enter the git pull –all command to pull all the changes from github
The git pull command merges the file from your remote repository (Bitbucket) into your local repository with a single command.
Navigate to your repository folder on your local system and you’ll see the file you just added.
Fantastic, pull command pulled the estate agent file to the local repository.