How to push, pull, and fetch from a remote repository using Git Bash

Home > Search > How-to

Let's take an example where you want to download files from a certain repository on In this example, John Doe has a repository named Stage that contains one file,


Use the git clone URL command to download the repository.

$ git clone
Cloning into 'Stage'...
remote: Counting objects: 3 done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-resued 0
Unpacking objects: 100% (3/3), done.


The dir command will show that the files from have been downloaded to the local PC.

$ dir
. . . 


Move into the Stage directory, and then use the git remote command to determine the alias of the remote repositiory.

$ git remote


In this example, John Doe's filles in a repository named Stage was sent to the local machine, using the alias origin.



When changes are made to the files in the GitHub repository, the git fetch name or git pull name commands can be used to download the updated files from the repository to the local PC. The git fetch name command will download but not merge the files into your branch. 

$ git fetch origin



The git pull name command will download and merge the files.

$ git pull origin
. . . | 1 +
  1 file changed, 1 insertion(+)



After making changes to files on your local PC, the git push name command will upload the files to the remote repository.

$ git push origin


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter in the box below so that we can be sure you are a human.