How to Git- gitignore & github Desktop

In this guide, we are going to learn how to ignore files using gitignore. And also we are going to use GitHub Desktop software which is free GitHub GUI. It is recommended to read our previous tutorial about GitHub.


Set up GitHub Desktop

Download the GitHub Desktop from  It is available for Mac and windows.

Install the setup file. Do your GitHub login and password. On config tab, fill out your name and email address. Next tab, you can add your local git repository to GitHub Desktop. If you don’t have any local repository, just leave it. Complete the configuration and go ahead to next step.


GitHub Desktop Installation


Once you finish the installation, open up GitHub Desktop from the start menu or from the installation folder. Now, you will see the GitHub Desktop GUI without any repository (local repository may included). Start with the plus button on the top left corner which gives you three options: Add, Create, and Clone.


GitHub Desktop Installation

gitignore & GitHub Desktop


Add: If you have a local repository on local git, you can add that repository to GitHub Desktop.
Create: This option is to create an entirely new repository.
Clone: This option is to find all repository that you have Github and bring them locally to your Github Desktop.

Now, let’s clone “Simple-website” repository from GitHub to GUI.  To do that, select the account from the left sidebar and locate “simple-website”. Clone the “simple-website”. Choose a directory you wish clone “simple-website” into.


Adding Repository

 gitignore & GitHub Desktop


Select default GitHub directory and start the clone. You can choose any of your repository (directory) to download. Once you finish the cloning our repository, you can view the history log by selecting history button. But there is nothing to display changes. Let’s make some changes.



gitignore & GitHub Desktop


Let’s go ahead and add some file to the repository to view some changes, Here we are going to make a whole page “About.html” and link it to the index.html. You can check the sample files at


Now, open up GitHub Desktop. you will see 2 changes in our repository. A green plus icon says that the files added to the staged area. let’s go ahead and commit the changes.


Commiting changes

gitignore & GitHub Desktop


To commit the changes, write a little message of what changes you did on text field at the bottom of GitHub Desktop. You can add an optional description. Click on Commit to master to commit the changes in repo.


Commiting changes


Once you commit the changes, click on Sync button to publish the changes you did on locally to GitHub. Let’s connect to the GitHub home and check out updated repo.


Commit conformation


Ignoring files and directories using .gitignore

A .gitignore is used to ignore certain files and directories for repository operations. You can use one or several .gitignore files. Typically, this file is located at the root of your Git repository but it can also be located in sub-directories.

For example, the following .gitignore file tells Git to ignore the bin and target directories and all files ending with a ~.

.gitignore code
    # ignore all bin directories
    # matches "bin" in any subfolder

    # ignore all target directories

    # ignore all files ending with ~


You can create useful .gitignore files from  Just go to and add your operating systems, your IDEs or programming languages. Once you click generate button, it will generate a .gitignore file that tells to git what to ignore. website

gitignore & GitHub Desktop


For example, we will create a gitignore file for windows and Notepad ++.  The following file is generated by for windows and Notepad ++. Copy the code or download it to our git repository.


.gitignore File
    # Created by,notepadpp

    ### Windows ###
    # Windows thumbnail cache files

    # Folder config file

    # Recycle Bin used on file shares

    # Windows Installer files

    # Windows shortcuts

    ### NotepadPP ###
    # Notepad++ backups #

    # End of,notepadpp


Once you created the .gitignore file, add and commit the changes and Sync it with GitHub repo. Open up the github and view the changes.


GitHub Preview


Files that are tracked by Git are not automatically removed if you add them to a .gitignore file. .gitignore file only affect new files. If you want to ignore files which are already tracked you need to explicitly remove them. The following command is used to remove files and directories explicitly from git repo.


Remove files from Repo
    git rm -r --cached <file_name/directory_name>


Muhsin Yakkiparamban

Muhsin Yakkiparamban is the co-founder of Lauyou Learning. Muhsin holds Bachelor Degree in Civil Engineering from KMCT Calicut.

You may also like...