Now that we have our GitHub account setup, let's create a new repo for our project.
- Click the "plus" icon at the top of the GitHub page next to your user name
- Select "New repository"
- Owner: (Unless you're a part of an organization, your name will be the only option. If you are a part of an organization, you can choose to make the organization the repository owner.)
- Repository name: My First GitHub Site (Name the repository.)
- Description (optional): This is the repo for the demo GitHub repo by Modules Unraveled.
- [x] Public (I'm going to make this a public repo, but if you need to create a private one, select "Private" and enter your billing information.)
- [x] Initialize this repository with a README (We're creating a brand new repository, so I'll go ahead and initialize it with a README. (The generated README will contain the repo name and description.) In the video Adding an Existing Repository to GitHub, we'll skip this and import an exiting repository from our local machine.)
- You can choose to add a .gitignore file from popular projects such as Drupal or Wordpress, but I'm not going to add one for this project.
- You can also specify the license for this project, but again, I'll leave this set to "None"
- Click "Create repository"
Now we're taken to the project page where we'll see the content of the README.md file and other information about this project like the number of commits, contributors and a link to clone the repo.
(The README file is written in the Markdown format. If you're not already familiar with Markdown, it is a text-to-HTML conversion tool for web writers. It is designed to be as easy-to-read and easy-to-write as possible, even before conversion. I highly recommend you look into it if you work on the web.)
Cloning a GitHub Repository to Your Local Machine with "git clone"
Now that we have the repository setup, we need to clone it to our local machine so that we can work on the project locally.
- On the "< > Code" page, find the clone URL in the sidebar.
- Select the "SSH" version
- Click on the URL and copy it, or click the "Copy to clipboard" button.
- Open a terminal window and navigate to the directory where you'd like to clone the project. (I'll clone it to my www directory, so I'll type "cd .." and press Enter.)
- Type "git clone " and paste the URL
- Press Enter
When you do that, the repository will be cloned to your local machine.
I'll use "ls" to verify the project was successfully cloned. Then I'll move into the project directory by typing "cd My-First-GitHub-Site" and pressing Enter.
Now, I can type "git status" and we'll see the message:
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
So, we've cloned the repo to our local machine, and are set to utilize Git and GitHub to track this project!