Domain and Hosting
Ninja Space Content Blog
Domain and Hosting
Ninja Space Content Tech Blog
Adding existing local directory to a new GitHub repo
Posted by Ninja Space Content on Wednesday, December 30, 2020
Under: tech issues
This week seems like a GitHub week for me. Managing files, looking up terminal commands to get my files properly backed up and remembering it all are taking me hours this morning.
I've successfully cloned my old repo earlier today using my two-factor authentication and right now, I've just created another new repo to back up an older jQuery project that I had built months ago. I ran into a couple of issues getting my jQuery project onto GitHub but after some digging, I got it up there now. I didn't originally do a git init for this when I was working on this project because I hadn't learned it yet. Now that I've graduated from my coding bootcamp, I am going back and making sure I have these files on GitHub. Here were my steps below.
(It didn't ask me for a password or token this time like my clone project had asked me due to two-factor authentication so that's one less step I had to make for this one!
You can read more about this two-factor authentication that I had to do
First, I created a new repository on GitHub on their website and then copied the file name by clicking on the green "Code" button.
Then, I went into my local file where my jQuery project files are and cloned it with the following in the terminal:
git clone http://github.com(my New GitHub file name).git
Then, I needed to get this local directory to git so I did a git init command in the terminal with this:
Then I tried to add all of my files to git by typing:
git add .
but it was giving all sorts of errors and by googling it, someone said they had to add the files one by one so I had to do that. For example:
git add app.js
git add index.html
and so forth. Then, when I typed
those files showed up green now so by adding individual files one by one, it worked!
So then, I committed it with:
git commit -m 'my message'
And then typed
and it provided me an upstream command that I copied and pasted and now my jQuery files are up on GitHub. Yay!
Using Two Factor...
github adding a new repo
« Back to posts
About Ninja Space Content
Ninja Space Content
Note: links to resources and promoting special deals may allow me to earn a small commission from each sale.
Work Station Accessories
Upgrading From heroku-18 to heroku-22 and...
Pros and Cons of G4 from Google Analytics...
How to Reset the ADT Doorbell by yourself
MISC: Useful Commands, Keys and Notes
My GraphQL Study
coding bootcamp (1)
Creating a Brand (1)
Domain Management (2)
Google Adsense (1)
Google Analytics (2)
Social Media (3)
tech issues (6)