course "Uploading your project to GitHub" (repository github-upload): step 2, prepare the project

I am stuck at step 2 of the Learning Lab course github-upload. 

I have to create a .gitignore file in my local environment. I can use a template or create my own.

What does “local environment” mean? I am working on a Mac. Do I have to use the Terminal and navigate first to my repository? If yes, how can I do that? 

On GitHub help it says:

  1. In Terminal, navigate to the location of your Git repository.
  2. Enter touch .gitignore to create a .gitignore file.

I am not very familiar with using the Terminal. How can I navigate to the location of my Git repository?

Many thanks for your help!

I am sorry this is not familiar to you. I will try and help.

Yes, your local environment is meant to mean your desktop computer or laptop. These days it could be a workstation in the cloud. It is simply a system with either windows, mac osx, or linux that can run git.

You would enter command line commands from a terminal session on this system. In mac osx terminal is in utilities under applications. In linux it is usually on the gui. I am not familiar with windows by I know some people install putty.

Then you must install git if it is not there. Installation will vary by machin OS type. You can google instructions for your system.

Once git is there, you use git commands to clone, add, commit, status, pull, push, etc. There are git cheat sheets on the internets as well.

I recommend that you look for an introduction to github and git learning lab as a starter, and get familiar with that first.

Please let us know if you have further troubles,

John Marx

1 Like

Hi @aurumpurum 

Hopefully I can help. Local environment basically means the machine you are working on that has your project folder. So in your case your Mac, you can create the .gitignore file manaually with any text editer, and save this in your project folder.

Or if you wanted to try in Terminal you would need to do the following:

  1. With a terminal window open type cd and then either type the path to your folder (Its Case sensitive) or drag the folder to the terminal window. It will look something like : 

    your-machine-name:~ username$ cd Path/To/My/Project/

  2. Hit return and the text will change slightly to: 

    your-machine-name:~ username$ cd Path/To/My/Project/
    your-machine-name:Project username$

You are now in your project folder where if you now use “touch .gitignore” this will create the file .gitignore which will probably be hidden if you try and look for it in the Finder. 

You can check if its there by using Terminal, or if you are using a text editor like atom you should be able to see this file in your projects tree

Screenshot 2019-10-01 at 15.27.00.png

From here you can modify the .gitignore in a text editer or in Terminal (using nano for example).

Hope that helps :slight_smile: good luck

1 Like

I forgot to mention if you were creating manually you might find when you save the file it might disappear due to the . at the start. In OSX these files are usually hidden.

Hi @crammers 

Thanks for giving me support! I really appreciate your explanation. 

So, when I create a new repository on my GitHub, this folder is going to be stored on my local computer? I thought it will be stored somewhere in the GitHub cloud, on the GitHub servers?

That’s my question: I don’t now, where GitHub stores my repositories on my computer. I tried to search for keywords like “github” or “repositories” in the Finder of my Mac, but couldn’t find the folder…do you know where GitHub stores files on a computer by default? How is it on your computer? I couldn’t find a path in my user’s folder either…:frowning: Thanks for further advice! :slight_smile:

No problem  @aurumpurum, it can be a bit confusing to get started understanding Git and Github :slight_smile:

If you create a repository on Github, nothing is created on your local computer. its it just living on Github.

If you want to create a copy of the repo from Github to your machine you can do this a few ways. 

Are you using Github Desktop? If so you can clone a repository using that. If I remember right using the Github Desktop will let you know if changes have been made on the repository on Github… its been a while since ive done it that way though. It might be that you can just click the  Fetch Origin  button, which is like saying “Go get me the most recent version of this repo”.

Or you can copy a repo from the Github site, you can download it using the  Clone or Download button. However, doing this will not mean your local copy will be kept up to date with and changed made directly on Github and vice versa. it is just a copy. 

Let me give you a couple of examples of my own Github (and git) workflow.

Firstly git : if you didnt know already, git is a thing in its own right and Github is like a place that uses understands and uses git. you can have git on your machine, its not in anyway linked to Github unless you make the link between your local repo and a remote repo on Github.

I have git installed  locally (although ive been using Github for longer than I’ve been using git on my machine!), and I feel it helped me understand what it is vs what Github is. I also use Atom as my text editor as this had git and github functionality built in.

So if you havent already, you might want to look into installing git on your local machine. Its not a  requirement  though. You can check if you have git installed by typing the following into Terminal

git --version

and after a short moment you should get an output similar to the line below.

git version 2.21.0 (Apple Git-122)

If not, and you get something like “git command not recognised” then you havent git on your machine. No worries though.

Anyway. an example workflow might be this:

  1. You create a folder on your desktop/Documents or where ever you like, to keep a python project in.
  2. You might now already have said “this will live on Github too” so on github you might create a repo called “My Python app” 
  3. you now want to make sure that your local code is saved along with all its history using git. so you would initialise (init) git on this folder in the command line, by using cd to get to your folder then typing git init.
  4. You can then tell git that this folder (which is now like a local repo) has a remote  repository on GitHub. in your Terminal you would type something like this, where the URL would be the URL to your repo
git remote add origin
  1. Now when you work on your app on the files on your machine, you’re working on your local copy, but now you can push changes (commits) to the remote copy on github. Sort of like backing up your saves, that pretty much whats going on. It also works the other way round where if you make a change on Github directly (or say from someone you are working with also commiting to your code) you can fetch those changes and you local copy will now look like the one from Github. All up to date and ready to rock.

With me so far?

Example 2: You have your remote repo, but nothing local, no project folder and no git installed.

If you have not git installed then you can clone the repo from github using the button mentioned before (This will be more or less an empty folder if you havent any code in there, else it will be full of folders and documents or whatever is currently in the repo on Github).

Now if you change any of this code (in the copy you have now downloaded), in order to update it in the repository on github you could manually edit the files, maually on there and commit them, but its probably not the best method to be honest. Or you could use the Github desktop app and update the repo from that.

Either way, a github repo is like a public or private copy of a folder. You might have a copy on your machine but Github wont do this for you if you are just creating a repo on there, you will have to copy it one way or other yourself.

I hope thats not far too much information to take in, sorry if it is.  Stick with it though, once you start understanding the basics its a fantastic tool!

Helpful links:

1 Like

Hey @crammers ,

thanks a lot. It’s a lot of information to take, but I really appreciate your effort to help me out! I will read your full post tomorrow.

But let us stay with my initial problem and question: I just want to store a .gitignore file in an existing repository, that I have on GitHub. As you know, I am doing the course “Uploading your project to GitHub” that is available at the Learning Lab.  So I have just ran into problems with the following task:

Following the indicated links, I reach a help site:

I just cannot follow the step-by-step instructions to create a local .gitignore:

I just don’t know how to find my location of my Git repository in the Terminal as stated in step 1 above.

Does that mean, that I have to create a local copy first? Or can I create a .gitignore file on the Web Applicaton of GitHub under my repository?

Just to let you know I have installed Git, it’s version 2.17.2:

I do have GitHub Desktop. But I haven’t used it yet, because I first want to finish some basic courses.

I really believe that it’s a very powerful application and I want to stick with it. But as you said, at the beginning it’s overwhelming because of the huge amount of information to process in my brain :slight_smile: Cheers!

Sure, in the previous issue it asks where is your project, so its asuming you have a folder with a project either already on your machine or somewhere else. If this isnt the case then this will be why the next step doesnt make sense. 

It would be best to create a folder somewhere on your machine, the desktop for example, and this will be your dummy project folder for this exercise, then you can create the .gitignore in there. Otherwise you can create a .gitignore directly in a repository on Github. Click the button  Create New File  and name it .gitignore

Anything you list inside this file will be ignored by git.

Commit it and thats it.

In step 3 you will be asked to go though the steps to upload the project so i would say creating the folder on your machine and making the .gitignore in there the better option

Hope that helps :slight_smile:

1 Like

Many thanks @crammers. Your advice has helped me a lot to better understand the workflow. Really appreciate your support! I will continue the course tomorrow :slight_smile: keep in touch!

No problem @aurumpurum, best of luck!

Hi @crammers, hope you are well! 

I have changed my username to @DataMower. Suits better to the world of bits and bytes and Data Science :slight_smile:

I have read your instructions concerning your GitHub-workflow and still have a question. Suppose I have written a little python program ( When I want to move it to GitHub, do I have to

  • put it into a folder first on my local machine, add a .gitignore and then move this folder as a repository to GitHub?
  • move the single file to GitHub as a repository?

Let’s consider a second case: let’s assume I have a folder where I store all the exercise files of a python text book I have, we call it textbook folder. This folder has,, etc. Do I have to create one single .gitignore file for this textbook folder? Or do I have to create a subfolder for each exercise and put a .gitignore file in each? Maybe you can help me…:slight_smile: I am still struggling with the first steps, it’s pretty tough! Thanks!

1 Like

Hey @datamower! Good handle :) 

Alright, so the first option:

Suppose I have written a little python program ( When I want to move it to GitHub, do I have to


  • put it into a folder first on my local machine, add a .gitignore and then move this folder as a repository to GitHub?

If you have no repository already in github where this will live, and you are making a new one then yes, you could do this.

You dont have to make a gitignore though, in this case if all you had was one repo with nothing else but a few .py files it would be fine. Its encoraged to use .gitignore so you dont accidently upload unessasary things (logs, env files or package folders like node_module), and if you were to share your repo publicly, others also then dont have to add one should they need it.

  • move the single file to GitHub as a repository?

A file cant exist as a repository, think of them simply as folders, you dont need to put it in a folder on your local machine but in github it needs to live in a repo or as a Gist (basically stand alone files and snippets - another topic another time  😀 ) 

Let’s consider a second case: let’s assume I have a folder where I store all the exercise files of a python text book I have, we call it textbook folder. This folder has,, etc. Do I have to create one single .gitignore file for this textbook folder? Or do I have to create a subfolder for each exercise and put a .gitignore file in each? 

Yes you would only need to create 1 gitignore and the the py files can be in subfolders or not, however you would normally organsie your code.

Only make one repository for each self contained application/project - so the Textbook would be one repo and all the code, notes, doc relating to that live in that repo. Other than that the organisation of what goes in it it pretty much up to you. Have a look at how others do it if youre unsure. Many have the main repo folder that contains a readme, maybe then the main file and a gitignore, then a few folders that usually contain all the main workings. others might have all the main working in the root of the repo.

Hope that helps! good luck

edit: fixed typo :slight_smile:

1 Like

Heyyy @crammers , thanks a lot for your advice, really appreciate it!

That is much clearer now. Gives me a lot of motivation to start uploading some projecs :slight_smile:

By the way: I checked your weather icon repository. In case I work on weather data one day, I might come back to your repository to get some funny icons that I can integrate in my jupyter notebook :-) 



Awesome @datamower thanks! those were my first go at making SVG’s so feel free to use or even update them!

Im glad that I was able to help, feel free to reach out should you need any further assist :slight_smile: