Difference between revisions of "Getting Started w/ Github"

From AstroBaki
Jump to navigationJump to search
Line 31: Line 31:
 
git commit -m "Your Commit Message"
 
git commit -m "Your Commit Message"
 
</source>
 
</source>
The commit message
+
The commit message is used to remind yourself and others what you changed when you made that commit. The message should be less than 50 characters but descriptive enough to remind you of what changes were made. Now that files have been added, we need to connect this repository to GitHub. You can do this with the following command
 +
<source lang="bash">
 +
git remote add origin https://github.com/<your-username>/<your-repo-name>
 +
</source>

Revision as of 11:41, 26 January 2021

Introduction

Revision Control

Creating a Github Repository

Links:

If you don't have a GitHub account that's where you'll need to start. You can get started setting up your account by going to github.com and log-in using an email. Github has special benefits for students so if possible, use your school email. Once you've set up an account, in the terminal type the following commands:

git config --global user.name "John Doe"
git config --global user.email johndoe@example.com

These commands configure your command line to use your GitHub username and email from now and this should be the only time you have to type these commands.

Creating a Repository

One of the main benefits of Git and GitHub is the ability to synchronize files between different working environments (like your personal computer and a remote computer). Here, we'll set up a git repository and connect that repository to GitHub in order to synchronize files between a remote computer and your personal computer. Start by moving into the directory that you would like to use as your repository. Next, run the following command to create a git repository:

git init

Once you've initialized your repository, add files by using:

git add {file}

or if you want to add all of the files in a directory you can use the following command:

git add .

Once you've added the files that you work like to add to GitHub, you will need to commit those files. You can do this by running the command,

git commit -m "Your Commit Message"

The commit message is used to remind yourself and others what you changed when you made that commit. The message should be less than 50 characters but descriptive enough to remind you of what changes were made. Now that files have been added, we need to connect this repository to GitHub. You can do this with the following command

git remote add origin https://github.com/<your-username>/<your-repo-name>