Push and Upload Existing Local Project to Github (NodeJS Project)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right so you've been working on your project locally for the past few weeks and now things are getting serious it's not just merely merely a hello world app anymore but it's actually evolved into something awesome and you want to share it with the world in this short drill we will look at how to push your local project that's currently not hooked up to any remote repository to github we will look at creating a new github repository and hooking that up to your local project so you can create branches make commits and push and ultimately share your code with the world now brace yourself because things are getting serious okay so here we have a simple project that we want to start pushing to github it has two modules it has an entry point file it installed some dependencies some node modules has a package log file and we want to push all this into github so that we can share it with the world because things are getting serious now initially when you run some sort of git command here it's not going to work because this is not a git repository right now in order to do so you need to navigate to the github documentation page to open up github once you log in click this on the right hand side go to help now let's search for an article that addresses this so search for add existing project and if you navigate down this is the article that we're interested in adding an existing project to github using the command line let's follow this step and then upload our local project to github but first create a new repository on github i'm going to open up github again so you can do that by clicking this plus button here and then click on new repository and give it a name i'm going to just name it existing project i'll just leave it as private you can give a description pushing local project to github demonstration uh you can add a readme if you want you can add getting now if you want but i'm just going to create it as an empty project which is going to have nothing so there we go it creates the project or the repository remotely on github so we're going to actually copy paste this right here this is the url to your project which we'll use later on let's move on so open git bash so in vs code i just opened git bash change the current working directory to your local project which is this initialize the local directory as a git repository so in here i can run the git init command and pass in the branch name that this is going to be i will just use master the documentation says main here but i'll just use it as master for now get in it be master there we go now vs code gives us a warning it has too many active changes the eslint only a subset of git features will be enabled would you like to add node modules to get ignored yes so you want to add the node modules into git ignore because the node modules folder there's a lot of different files so this is all the libraries that you're using that your project is dependent on and you don't need to add this specific library file files or source files into your project because the package.json defines all the dependency and the package.log defines the versions that you're using so you know when you do npm install or uninstall it's going to install the same node module so there's no reason to add all of the libraries you know modules library into github it just bloats the floats your repository so it will add so it added a git ignore file and it's going to ignore every single folder and file in the node modules folder highly recommend you to follow these steps let's move on so we initialize the project and now git actually is going to start working you can get status you can do like a git log which it doesn't have any logs because there is no commit so we're going to add a first commit to commit all of our files so git add current directory so what this does is it added all of the files and stage them to be committed so the eslint file the ignore file the index the entry point and the two modules and your and your settings your package.json settings so here we're going to commit with a commit message let's say uh first commit now you don't get log you see that now we have a commit here but if you navigate your server or your github there is no file so we're refreshing but doesn't see anything it's because we didn't push um our branch we didn't push our repository so what we need to first do is we need to hook up this repository to to your local project and in order to do that here is the magic command git remote add urgent git remote add origin so this defines the origin repository as the one that you just created so this existing project which is defined by the url so now once you run this command your system knows that origin points to your github remote repository and you can verify that by running this command git remote v now it's going to print out the origin represents this your origin represents this for fetch and pushes now moving along once that's done you can basically push to your remote repository and that command is right here hit push origin and because i created my master branch or i created the branch name as master i will push to master on the remote repository once this completes after you put in your password there we go it now pushed the master branch upstream so when we refresh our repository we're going to now see code there we go looks beautiful the master branch has all the files that we committed and let's just verify the commit history by clicking on this on the right hand side first commit 7 a e b and let's verify that if that's indeed the commit that we just made yes 7 aeb but this is the commit that has been pushed and from here on you can do whatever you need to do let's for example create a branch let's create the staging branch off of the master branch so we created that staging branch locally and now we can push upstream staging there we go so it pushed our staging branch upstream and we can verify that by going back to our repository refresh this page go to code refresh this page and then we can verify that staging has indeed been pushed so now although your git functionalities will work you'll be able to push pull fetch uh you know create branch or do whatever you need to do so that's pretty much it for this so once you start getting one search code is starting to get serious start pushing the github thank you for tuning in guys all right if you guys enjoyed that video please like comment and subscribe like comment and subscribe like comment and subscribe how long are we doing this like comment and subscribe like comment okay i'm done
Info
Channel: Bout Education
Views: 23,267
Rating: undefined out of 5
Keywords: pushToGithub, push Github, upload to github, local project to github, how to upload existing project to github, setting up github, uploading to github, upload project to github
Id: BK2pzY9sT0k
Channel Id: undefined
Length: 7min 59sec (479 seconds)
Published: Thu Apr 01 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.