

Go back to your terminal or if you’re using Visual Studio Code you can open the built-in terminal by pressing Ctrl + ` (backtick). MacOS users: If your terminal reads “command not found: code”, you must head back to Command Line Basics and follow the instructions provided to allow this command to work.Īdd “Hello Odin!” to line 3 of README.md and save the file with Ctrl + S (Mac: Cmd + S). In this example, we will open the directory in Visual Studio Code by using the command code. Open README.md in your text editor of choice.

You can configure settings for this later, but don’t worry about it too much for now. If your terminal is stuck in a screen with (END) at the bottom, just press “q” to escape. You will also see details on the author who made the commit and the date and time of when the commit was made. You should see an entry for your “ Add hello_world.txt” commit.

You will be uploading your snapshots further down in this lesson. The message, “ Your branch is ahead of ‘origin/main’ by 1 commit” just means that you now have newer snapshots than what is on your remote repository. It will be resolved once you have followed the rest of the steps in this project. This is normal and only shows when your cloned repository currently has no branches. Don’t worry if you get a message that says “ upstream is gone”. The output should now say: “ nothing to commit, working tree clean”, indicating your changes have been committed. Type git commit -m "Add hello_world.txt" and then type git status once more. In the output, notice that your file is now shown in green, which means that this file is now in the staging area. Think of the staging area as a “waiting room” for your changes until you commit them. The staging area is part of the two-step process for making a commit in Git. This command adds your hello_world.txt file to the staging area in Git. In the output, notice that your hello_world.txt file is shown in red, which means that this file is not staged. (Don’t worry about the details of origin for now it will come up again near the end of this tutorial.)Ĭreate a new file in the git_test folder called “hello_world.txt” with the command touch hello_world.txt. But it could have just as easily been named “party-parrot” or “dancing-banana”. The name “origin” is both the default and the convention for the remote repository.

You may have also noticed the word origin at the start of the git remote -v output, which is the name of your remote connection. This will display the URL of the repository you created on GitHub, which is the remote for your local copy. To test this, you can cd into the new git_test folder that was downloaded and then enter git remote -v on your command line. That’s it! You have successfully connected the repository you created on GitHub to your local machine.
GIT ADD ALL MODIFIED FILES FULL
The full command should look similar to git clone If your URL looks like, you have selected the HTTPS option, not the required SSH option. Now it’s time to clone your repository from GitHub onto your computer with git clone followed by the URL you copied in the last step. Once it’s made, move into it with the cd command. If you’re not sure if you’re in your home folder, just type cd ~. Navigating Files and Directories covered variations of home folders - sometimes ~ stands for /Users/your_username and sometimes it stands for /home/your_username. Create a directory called repos with the mkdir command in your home folder. Let’s use the command line on your local machine to create a new directory for all of your Odin projects. NOTE: You MUST click the SSH option to get the correct URL. Then select the SSH option, and copy the line below it. To get ready to copy (clone) this repository onto your local machine, click the green “Code” button. This will redirect you to your new repository on GitHub. And then create the repository by clicking the “Create repository” button at the bottom of the page. Give your repository the name “git_test” in the repository name input field. If you haven’t done that yet, you can sign up here.Ĭreate a new repository by clicking the button shown in the screenshot below. You should have already created a GitHub account in the Setting Up Git lesson. For more information on the change from master to main see GitHub’s Renaming Repository.If you haven’t already, set your local default git branch to main.This means you need to make sure you are using a recent version of git (2.28 or later). Github recently updated the way it names the default branch.
