Initial Content

Introduction to Git & Markdown

Adding initial content to README.md.

Page contents

Headings

Introduction

Now that we have a repository, with a README.md file, we’ll add Markdown-formatted headings (also known as headlines) to the file, commit the changes to the local Git repository, and push those changes to the remote repository (hosted on GitHub). This will result in the automatic conversion of the Markdown headings to HTML headings, and publication of the HTML content to your personal GitHub Pages website.

In the next few sections of the tutorial, we’ll be using a number of different Markdown formatting rules, and a few Git commands. Rather than explain the required formatting rules and command syntaxes in detail ahead of time, some steps will include relevant notes, prefaced by Formatting rules or Command syntax

Steps

  1. Locate the directory you created in Create & clone in the relevant file manager program for your environment (e.g. File Explorer in Windows, Finder in OS X, File Manager in Linux Ubuntu).

  2. Open the README.md file in your secondary text editor (that is, the editor you installed during environment preparation—Notepad++, VS Code, Brackets, TextMate, etc.)

  3. Replace the default contents of the file with the following basic information. Please replace {your name} placeholder with your name, as you wish it to appear on your personal site. Be sure not to leave the curly braces in the content.

     # {your name}
        
     ## Introduction
        
     ## Current projects
    
     ## Links
    

    Formatting rules

    • The hash mark characters denote heading: 1 hash mark for a top-level heading, 2 marks for a second-level heading, and so on. There must be no spaces between the hash marks; on the other hand, there must be one space after the hash mark(s), before the text that follows on the same line.

    • Markdown uses an indentation scheme driven primarily by ordered (numbered) and unordered (bullet) lists; ignoring the current indentation level will lead to unexpected—and usually undesired—results. The headings we’re creating here are not part of any such list; therefore, there must be no spaces before the hash marks on the lines shown.

    • Please don’t ignore the single blank lines that come between the headlines; these are required.

  4. Save the file, but leave it open in your text editor. (Changes that aren’t saved can’t be committed to the repository.)

    Note: Keep your text editor open for the rest of this tutorial. Also, unless otherwise directed, please keep the README.md file open for editing.

  5. In your shell program (which should still be open from the previous portion of the tutorial), execute the following Git commands; for now, execute them one-at-a-time, by typing or copying and pasting each line individually, rather than copying and pasting all of the commands at once. After the last one, you will be instructed to type in your SSH private key passphrase; this is the passphrase you specified when you ran the ssh-keygen command when configuring your Git installation’s connection to your account on GitHub. Please note that nothing will be echoed to the screen as you type the passphrase. After the commands are completed, leave the shell program open.

     git add .
     git commit -m "Initial headings"
     git push
    

    Command syntaxes

    • The git add . command stages (prepares for subsequent commit) all added, changed, or deleted files in the current directory and any subdirectories. (In most shell programs, a single period character represents the current directory.)

    • The git commit command commits all staged changes to the local repository. The -m option is used to include a (required) commit message; this message is specified in the quotes that follow the -m option.

    • The git push command propagates any local commits to the default remote repository—in this case, the repository you created initially on GitHub.

  6. Now, review your published content. Since this repository is being used for a GitHub Pages site, you should review it in the browser:

    1. Open a new browser tab.

    2. In the browser address field, type the domain name of your personal GitHub pages site. This will actually be the name of the repository you specified in “Create & clone: Create repository”—that is, your GitHub user name, followed by .github.io. (The actual URL begins with https://; however, the browser will assume that, if it is not specified.)

    3. If the content you typed in the steps above doesn’t appear immediately, wait for a minute or two, and refresh the web page. Note that it can sometimes take a couple of minutes for a GitHub Pages site to be updated, after the content is pushed to GitHub.

      On successful publication, the displayed page should look something like this (of course, this example doesn’t show your name, but your page should):

      Alicia Q. Student

      Introduction

      Current projects

    4. Leave this browser tab open, to make it easier to review the changes you make in the rest of the tutorial.

Paragraph text

Introduction

Now that we’ve created some headings, we’ll add some basic paragraph text below one of the headings. Just as is the case for HTML, Markdown doesn’t require us to break up the lines of text to fit the page: they will automatically be wrapped to fit the space, according to the style rules for that page. In fact, even if we do break a line—e.g. by typing [Enter] to break a single line into two lines—the line break will be ignored by Markdown (and by HTML), with the following exceptions:

Steps

  1. If it’s not still open in your text editor, open the README.md file for editing.

  2. Between the ## Introduction and ## Current projects lines, add a short paragraph of text, introducing yourself. Treat this paragraph much like an introduction section of a resume: It might be a short summary of your career objectives, relevant personal qualities or traits, etc.

  3. Make sure you have a blank line after ## Introduction, and another before ## Current projects; your new paragraph will be between those blank lines. The result will look something like this example (of course, your first heading and the contents of the paragraph you just added won’t be exactly like this; this is just an example):

     # Alicia Q. Student
        
     ## Introduction
        
     I'm a self-motivated quick learner, currently attending the Deep Dive Coding 
     Java + Android Bootcamp. My plan after graduation is to look for employment 
     in Java enterprise-level development.
        
     ## Current projects
    
  4. In your shell program (which should still be open from the previous portion of the tutorial), execute the following Git commands, one at a time. Once again, after the git push command, you’ll be instructed to type in your SSH private key passphrase. After the commands are completed, leave the shell program open.

     git add .
     git commit -m "Introduction paragraph"
     git push
    
  5. In your browser, review your published content on your GitHub Pages website. Remember that it may take a couple of minutes for your changes to be converted to HTML and published to the GitHub Pages website.

    When updated, your page should appear something like this:

    Alicia Q. Student

    Introduction

    I’m a self-motivated quick learner, currently attending the Deep Dive Coding Java + Android Bootcamp. My plan after graduation is to look for employment in Java enterprise-level development.

    Current projects

In the next part of the tutorial, “Lists & links”, we’ll add an unordered (bullet) list of projects to the Current projects section (this will be mostly empty, for now—but that will change soon enough); we’ll also add a link to your LinkedIn page (or some other aspect of your online presence) to the Links section.