Clone Repository & Push Changes using Visual Studio Code

There are two methods I use to push code to GitHub.  Method 1. Visual Studio Code.  Method 2. Git Bash.  Both are effective and I know people who use one over the other all the time.  In this article I will walk through cloning your repo in GitHub locally via HTTPS, clone the repo, and then push changes to your GitHub repo via Visual Studio Code.

If you are looking for my blog article on how to do the above via Git Bash, please go to this URL:
https://digitalthoughtdisruption.com/2020/09/09/clone-repository-push-changes-using-git-bash/

If you are looking for an article on how to create the GitHub repository please see the following link:
https://digitalthoughtdisruption.com/2020/09/09/create-a-repository-in-github/

Step by Step Process:

Go to https://www.github.com

Go to the repository you have already created – my example is vscodeexample

Screenshot from the Clone and Push a Repository With Visual Studio Code walkthrough at step 1, showing Gy Projects © Security Lx. Insights; the step instructs the user to go to the repository you have already created - my example is vscodeexample.

Click on code and grab the Clone with HTTPS URL

Then open the Git Bash

Screenshot from the Clone and Push a Repository With Visual Studio Code walkthrough at step 2; the step instructs the user to click on code and grab the Clone with HTTPS URL.

$ la -la

This will show nothing is in the /vscode/externalprojects folder I created earlier

$ git clone <contents from clipboard>

This will clone the repo locally

$ ls

This will now show the repo that was created on GitHub on your local machine

Screenshot from the Clone and Push a Repository With Visual Studio Code walkthrough at step 3, showing File Edit Selection; the adjacent article text explains that go into VS Code and click File > Open Folder.

Go into VS Code and click File > Open Folder

Screenshot from the Clone and Push a Repository With Visual Studio Code walkthrough at step 4; the step instructs the user to select the folder then select folder.

Select the folder then select folder

Screenshot from the Clone and Push a Repository With Visual Studio Code walkthrough at step 5; the step instructs the user to select the folder then select folder.

As you can now see you are in this folder in VS Code

Screenshot from the Clone and Push a Repository With Visual Studio Code walkthrough at step 6, showing File Edit Selection; the step instructs the user to select the folder then select folder.

File > New File

Screenshot from the Clone and Push a Repository With Visual Studio Code walkthrough at step 7, showing File Edit Selection View; the adjacent article text explains that file > New File.

I put some basic text in here

Screenshot from the Clone and Push a Repository With Visual Studio Code walkthrough at step 8, showing J File Edit Selection; the adjacent article text explains that file > New File.

File > Save

Screenshot from the Clone and Push a Repository With Visual Studio Code walkthrough at step 9; the adjacent article text explains that the author gave it a name and put .ps1 at the end to make it a powershell script to show you something later.

I gave it a name and put .ps1 at the end to make it a powershell script to show you something later

Screenshot from the Clone and Push a Repository With Visual Studio Code walkthrough at step 10; the adjacent article text explains that the author gave it a name and put .ps1 at the end to make it a powershell script to show you something later.

Shows your untracked changes

Screenshot from the Clone and Push a Repository With Visual Studio Code walkthrough at step 11; the step instructs the user to click the + sign to stage changes.

Click the + sign to stage changes

Screenshot from the Clone and Push a Repository With Visual Studio Code walkthrough at step 12, showing SOURCE CONTROL; the step instructs the user to click the + sign to stage changes.

Select the check mark to commit the changes

Screenshot from the Clone and Push a Repository With Visual Studio Code walkthrough at step 13; the step instructs the user to select the check mark to commit the changes.

Enter the message you want associated with this commit

Screenshot from the Clone and Push a Repository With Visual Studio Code walkthrough at step 14; the step instructs the user to click the synchronize changes button next to master.

Click the synchronize changes button next to master

Screenshot from the Clone and Push a Repository With Visual Studio Code walkthrough at step 15, showing Visual Studio Code; the step instructs the user to click the synchronize changes button next to master.

OK

Screenshot from the Clone and Push a Repository With Visual Studio Code walkthrough at step 16; the step instructs the user to click the synchronize changes button next to master.

The wheel will spin until changes have been pushed

Visual Studio Code prompt asking whether the Git extension may periodically run git fetch.

If you have not done so already I recommend clicking Yes

Screenshot from the Clone and Push a Repository With Visual Studio Code walkthrough at step 18; the adjacent article text explains that if you have not done so already I recommend clicking Yes.

When you refresh the GitHub repo you should see the new file and under Languages it even says that so far 100% of the files are in PowerShell

Summary:
As you can see linking a repo and pushing updates from your local VS Code to your central repo on GitHub is pretty easy once you know what you are doing.  As always, I hope y’all found this useful.

Continue reading

Clone Repository & Push Changes using Git Bash

Explore another guide in this topic and build on what you have just read. Read the article

2 thoughts on “Clone Repository & Push Changes using Visual Studio Code”

Leave a Comment

Discover more from Digital Thought Disruption

Subscribe now to keep reading and get access to the full archive.

Continue reading