So a couple of weeks ago, I can up with this fun idea to come up with a "Random Activity Generator" using Ruby. In the last blog, I reviewed selecting random values, case statements, and using require_relative. This week, I'll go over pushing your local repository up into your remote repository in GitHub. So let's get started!
We'll start by creating a new repository on your GitHub account. Click the green button that reads "New" (see image below).
Next, it'll redirect you to create your new repo. First, we'll give it a name, preferably a name that isn't being used (STEP 1), then decide whether it'll be a public or private repo (STEP 2), and finally click "Create Repository" (STEP 3).
After officially creating your new repo, it'll redirect you to a new page giving you instructions like so:
Before we push our existing code into the repo, we're going back to our code to run git status
from your command line to check the state of the working directory and staging area. The following error message may appear:
Untracked files:
(use "git add <file>..." to include in what will be committed)
../.DS_Store
./nothing added to commit but untracked files present (use "git add" to track)
This message means that Git sees multiple untracked files, and it won't include those files until it's told to do so. Just run git add .
to add all untracked files in the current directory to the next git commit. Now we can run git status
again to confirm that our two files are there. You should see the following message:
On branch main
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: activity.rb
new file: greetings.rbUntracked files:
(use "git add <file>..." to include in what will be committed)
../.DS_Store
Now that the files are there, we going to run the following code:
git commit -m "initial commit"git remote add origin [copied web address]git branch -M main
git push origin master
Now you should see all your files on your remote repo like so:
Feel free and comment, share and check out some of the resources and the repo created for this program posted below. Thanks for reading!