…or rather “How to git setup on Github”? Ok I’ll let myself out. But first I’ll finish writing this tutorial.
Pretty exciting because I finally got to learn some Git today, and just created my first repository on Github. My first repo is on that dear weather app I created back in November. I submitted it as a Term 2 portfolio piece, and have received some pretty great feedback from my classmates. According to my Github account, February 2nd was when I first started my web development training on Free Code Camp. Pretty cool! Can’t believe it’s almost a year.
Here’s a step-by-step tutorial on how I would create a Git repository on GitHub.
Homebrew – Install this so you can install Git
SourceTree – To interact with Git
On the command line, type:
brew install git
Once Git is done downloading, you can double-check to make sure that it’s fully installed. One way to check is by pulling up the version of git that you have. To do so, you can type the following to the command line (there are 2 dashes before version):
git --version
Create a workspace directory inside your home directly. You can name it whatever you like but I called mine “workspace’. Once you’ve got a directory in there, put your project directory inside the workspace directory.
I like the initialize my repository inside the command line and then open it up in SourceTree. To do so, you’ll want to type the following:
ls
This will list all the files inside the user directory.
Next, you’ll want to change the work directory to your project. Since my file name is js-project (for demo purposes), this is what I did:
cd workspace/js-project
cd stands for change directory and will access the contents of the workspace directory. Typing cd workspace in the command line is basically the same as double clicking the workspace directory.
When you are done this step, don’t close your Terminal yet because you’ll need it later.
Go through the setup which includes creating an Atlassian account. After that, connect SourceTree to your GitHub account.
You’ll want to add a repository under the local tab. You can do that by dragging your repository to SourceTree. Once your files are added, head over to your GitHub account. You should be able to see that repository on your profile.
Click into your repository on GitHub and you should see a setup guide. I like to create a new repository on the command line. To do so, you copy and paste each line of code given to you from GitHub that pertains to your files.
echo "# js-project" >> README.md
Echo is a command-line command to print on the screen >> README.md means it’ll re-direct that output to a file, and creates that file.
git init
Git init pretty much means “I want to track the files in this directory.”
git add . -m "first commit" git remote add origin https://github.com/user/js-project.git git push -u origin master
Once you have copy and pasted the code, you’ll be prompted to sign in to GitHub on Terminal.
Take a look at your repository on GitHub. It now has all the documents plus a README.md file. Be sure to include a short and meaningful description of your repository.
The README.md file allows you to put a longer and more detailed description of your repository. You can include whatever you like to supplement on there.
You are pretty much done here. To make or update any changes, you can do so through SourceTree.
Categories
Submit a Comment