No problem @aurumpurum, it can be a bit confusing to get started understanding Git and Github
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
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:
- You create a folder on your desktop/Documents or where ever you like, to keep a python project in.
- You might now already have said “this will live on Github too” so on github you might create a repo called “My Python app”
- 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.
- 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 https://github.com/user/repo.git
- 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!