Git Readme

How to setup a github user readme

Kyle Tolliver
03-13-2021

This page is a tutorial for how to set up a useful readme for your github user.

Step 0 – Git Setup

Step 1 – Create Repository

First you will have to create a repository with the name of the repo the same as your github username.

You can see it’s set to public that is needed for everyone to see the repo. And Initialize the repo with a Readme File.

Step 2 – Create Rmd file

There are two different ways to create the Rmd file for this project.

2.1 – Method 1

Top left of R Studio there is a white box with a plus in a green circle. Press that then a popup will show up. Go to templates and scroll till you find the github document template. It will open an untitled file. The file heading will say:

--- 
title: "Untitled" 
output: github_document 
---

Then Change title to your name first and last. (For example if I was John Doe then the title would be ‘title: “John Doe”’)

Save the file as Readme.Rmd

2.2 – Method 2

Top left of R Studio there is a white box with a plus in a green circle. Press that then a popup will show up. Pick any template for this method it doesn’t matter. It will open an untitled file. The file heading will say:

--- 
title: "Untitled" 
output: template_document
---

Rewrite the heading to say:

--- 
title: "First_name Last_name" 
output: template_document
---

Save the file as Readme.Rmd

Step 3 – Source the R Script

You can source a R script that will have the function useful for the readme file. The command needs to inside in an R chunk.

source("https://raw.githubusercontent.com/Tolli-Tech/Tolli-Coding/main/_posts/2021-03-13-git-readme/git-readme_files/git-readme.R")

Or you could just add this function in an R chunk.

user_stats <- function(user){
pander::pander(glue::glue('<h2>User Stats</h2>
<a href="https://github.com/anuraghazra/github-readme-stats" align="center">
<img style="max-width:100%;" height="160" align="center" 
src="https://github-readme-stats.vercel.app/api/top-langs/?username={user}&layout=compact&theme=gruvbox" /></a> \n\n\n'))
}

Link important sites, such as:

Use the link convention for Rmd files:

[name](link)

Step 5 – User Stats

Put the following function call in a R chunk:

user_stats(username)

For example if my username was johndoe the function call would look like:

user_stats(johndoe)

Step 6 – Highlights

Add a bulleted list of projects you want to highlight. Use the same link convention as earlier.

Step 7 – Knit

There are two different ways to knit the Rmd in RStudio.

Method 7.1 – Short Keys

The short keys need are:

Method 7.2 – Manual Knit

At the top left corner off the Rmd file there is a button with yarn and needles with the ‘Knit’ next to it.

Step 8 – Git It

When you feel your Readme file is good, you would be read to push it to github. (You can edit and push the file over and over again)

Use either the github website or github desktop app. Write a commit message, could be whatever you want. (A good commit message would be: ‘Readme.md edit’)

Then push the file to to your repository.


Now you are good to go and have a impressive Github profile.

Finished product will look similar too:

Citation

For attribution, please cite this work as

Tolliver (2021, March 13). Tolli-Coding: Git Readme. Retrieved from https://tolli-coding.netlify.app/posts/2021-03-13-git-readme/

BibTeX citation

@misc{tolliver2021git,
  author = {Tolliver, Kyle},
  title = {Tolli-Coding: Git Readme},
  url = {https://tolli-coding.netlify.app/posts/2021-03-13-git-readme/},
  year = {2021}
}