In this activity, you will clone your GitHub repo, create a folder structure, and then push those changes to the main branch.
Complete the following steps.
-
Before you can clone your repository from the command line, you will need to configure the command line to your GitHub username and email address. To do this run the following two commands, substituting your own GitHub username and the email you used to set up GitHub:
git config --global user.name "YOUR_USERNAME"
git config --global user.email "your_email_address@example.com" -
Next, navigate to the GitHub website. Click on the "Clone or download" button, and then copy the repo link.
-
Open the command line and run the command
git clone <repository link>to clone the repository to your local file system. -
Create the following folders in the local repo:
code,data,references, andimages. -
Create a
.gitkeepfile within each subfolder so that git knows to retain the empty folder. (Remember, empty folders are not added to git repos by default.) -
Run the
git add .command to add all changed files to the tracked files queue. -
Run the
git commit -m "<message"command to group tracked/changed files as a checkpoint prior to uploading to the remote git repo. -
Execute
git pushto push the commit to the remote git repo. -
Navigate to the GitHub website and confirm that the changes have been made.
GitLab has a pretty good tutorial on how to use the git CLI. Check it out here.
© 2019 Trilogy Education Services