From the course: Git Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Initialize a repository locally and sync it to the remote repository

Initialize a repository locally and sync it to the remote repository

From the course: Git Essential Training

Initialize a repository locally and sync it to the remote repository

- [Instructor] So let's look at a different scenario. Let's say we have an empty remote repository and we have some code already in our local environment, and we want to push that to the remote repository. As you see here, I made a repository that I did not initiate, so there's no README in there. There's no code at all. As you see, the web interface is already helping me with options to set this up. But let's see how we do it in Visual Studio Code. For now, I will copy the URL as I'll need it later. I'll open Visual Studio Code. Now, this file at this point is just a local folder. Let's change it into a local Git repository. We do that by using git init. We now have an empty repository. Let's add that file we've created. So I'll use Git add dot to add everything to the staging area and then I'll commit it using git commit, m for the message. And then I'll use initial commit, which is often to the default message we use…

Contents