How to Push Code to GitHub from Visual Studio Code & Create a GitHub Repository (2024 updated)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi guys welcome back today I'm going to show you how to set up your first GitHub repository then link it to your vs code to then be able to change files on your computer and push them back to the GitHub repository so I'm going to show you how to do this for your own private repository let's go to github.com and I assume you already have an account made so I'm not going to do this for you but make an account if you don't have one then click on sign in choose your GitHub account uh type your password sign in and then you can go up here on the right to your repositories and you can see an existing repositories if you don't have one click on new up here in and green so let's create a new repository we're going to call it best repo ever some description this is optional description and we'll make it private because doing it for public repository is even easier if you can do it for a private repository you can definitely do it for a public repository let's is that a readme file it's just going to be a file that describes the project and create repository you can also create the repository on your computer and then push it to GitHub but I think this is way easier and it's going to allow you to do it much quicker so now you have this repository with the read me file that has some text in it we can change it on github.com this is not really the purpose but we'll change it on our computer later so some text written on github.com let's commit those changes and then first commit done in the browser okay so now if we go back to our repo this is now the new text but what we want to do is we want to pull this or clone this repository onto our computer change files on our computer and push them back to the GitHub repository so that's what we're going to do now so let's open Visual Studio code okay so here what I'm going to do is go to Source control and clone repository so we've done this before in a previous video I'm going to on github.com click on the green button here and I'm going to use htps for now click on copy URL to clipboard this is our repository URL go to visual studio code and when we click on clone repository we can now paste the URL here select it and now Visual Studio wants to log into GitHub for us and we're going to allow it authorize Visual Studio code and we open vs code and select the destination folder so you need a folder on your computer where we want to clone this repo to we've done this before so let's open that and we're going to put it here next to the other ones and you see down here it was downloaded very quickly we we can now open this repository directly in Visual Studio code and here's the read me file as it is right now so some text written on github.com so now let's add a new line saying some text written on my local computer okay so now we have a change you see this in green here and we can now save this file save and now we can go on Source control again on the left side here you see a little one this means there's a pending change so we're going to open it and this is the file that changed and the first thing we need to do is we need to add this file to the staged files so there's a little plus button here so we're going to click on it and it's going to Stage this change so it's going to tell git to make this change ready to be pushed to the repository basically so we're going to click on the plus and now you see it moved from changes to Stage changes we can move it back by clicking on the minus but we want to commit it so committing means we're telling git that this change is final more or less and we're going to add a message to our changes so Su commit message changed line of text in read me file so you basically explain what you did and now I'm going to click on Commit and it gives me this error message so if you haven't done this yet you have to set up your username and user email in git so we can do this on the command line for example in Visual Studio code so we're opening a new terminal and now we're going to do get config minus minus Global user.name and then your name and then we're going to do the same thing for email some email at gmail.com which is a fake email of course and now hopefully it should work and it did the commit and now I'm going to sync changes and click okay and that's it so let's go to GitHub and see that the changes have arrived okay so this is now the read me file of best repo ever and you can see there's now the new line some text written on my local computer so that's it hopefully you learned something thanks for watching and see you next time
Info
Channel: Infinite Codes
Views: 4,854
Rating: undefined out of 5
Keywords: how to push visual studio code project to github, how to push vscode to github, upload visual studio code project to github, how to push project from visual studio code to github, upload from visual studio code to github, project from github to visual studio code, how to pull project from github in visual studio code, how to push visual studio code to github, how to use git and github in visual studio code, how to push code to github from visual studio, vscode github, vscode git
Id: 0LrNRBI_mYU
Channel Id: undefined
Length: 5min 24sec (324 seconds)
Published: Sun Mar 24 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.