Just the basics of git. In this README it'll outline the basics of pushing your lab to github.
- If you haven't already, install git. Here's a link that outlines how to install git across multiple operating systems: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
-
Create a folder. Then in your terminal, change directory to that folder
-
Make sure you're in that folder. Then initialize the folder as a git repository via
git init
-
Copy the https link to the repository. You can find it on the main page of your repository. Click on the green button on the right that says "Code" and copy the link. It should end with ".git"
-
Clone or pull the repo. Either way works for the case of the lab, but I highly encourage you to look up the difference between the two since you'll probably be using git for your group projects. To clone the repo, use
git clone <your repo link here>
. For example in this repo, I would type this in the command line:git clone https://github.com/kermattC/tutorial-repo.git
. And for pull:git pull https://github.com/kermattC/tutorial-repo.git
-
You can now make changes to the files you've cloned/pulled from the repository.
-
Add the files you've made changes to. You can add them individually using
git add <file or folder name here>
. You can usegit add .
to add all the files and folders that have your local changes too. -
Stage your changes. You can do so via
git commit
, which will launch a text editor. You should put a message that briefly describes the changes you made, so you can refer back to it in the future. A shortcut is to dogit commit -m "describe your changes here"
where you can put the commit message in the same line -
Push your changes. Now that you're ready to upload, you can do so using the git push command. You can add a tracking reference by adding
-u
at the end. You should also specify the origin and the branch you're pushing to ->git push -u origin <branch you're pushing to>
. -
Add your username and password. You'll need to sign into your github account in order to push. You can sign in using the window that pops up. Another way is to exit that window, and the CLI should direct you to enter your username. You'll need to enter your github username, then for the password you need to enter a Personal Access Token. This is NOT the same as your github account password. If you need help finding out how to create a personal access token, go to this link: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
It is highly encouraged to look up what these commands do and why it is done.
-
Intall GUI. Here's a link containing many choices of github gui: https://git-scm.com/downloads/guis/. I'll be using Github Desktop for Windows
-
Sign into Github.com and authorize
-
Make sure you have the correct email. You can select "Use my GitHub account name and email address" to autoamtically select your email.
-
Click on "Clone a repository from the Internet..."
-
You should have a list of repos available for you to clone. Just type in the search bar for your repo, select it and clone.
-
You can now make changes to the files you've cloned/pulled from the repository.
-
Stage changes. Any changes you've made should automatically appear in the gui. You can add the description of your changes in the bottom left. When ready, click on "Commit to main".
-
Push changes. Click on "Push origin" and your changes will be uploaded.