Where are my files when I use GitHub with VS Code?

November 13, 2026 4 answers
Asked by local__weather_report

I have a folder of code on my computer and a repository on GitHub with a few files uploaded. I can see the GitHub files in VS Code, but I don't know where the local copy is or how to connect it to my existing folder.

How do I edit the right file and get new files onto GitHub without uploading them through the website every time?

Answers

93b!crank_52

Think of these as separate things. Your local folder holds the files you edit. Git tracks versions of those files in a repository, usually using a hidden .git folder inside it. GitHub hosts a remote repository, and VS Code is an editor that can work with Git.

A file on GitHub and a file on your computer are separate copies. Editing one doesn't automatically change the other. A commit records a snapshot locally, push sends commits to GitHub, and pull brings remote changes into your local repository.

Seeing a repository in VS Code doesn't by itself tell you where a local copy is. Check the folder or workspace you opened and its path. If you opened the repository remotely rather than cloning it, there might not be a local working copy yet.

28v+tram_64:

If there are two files named hello.py, their folder paths tell you which one you're editing. The name alone isn't enough.

Reply to this answer
no.warranty.implied

The simplest starting point is usually to clone the GitHub repository into a new folder on your computer. Pick a location you can find again, then open that cloned folder in VS Code. Cloning sets up a local repository and connects it to the GitHub repository as a remote.

Copy hello.py from your existing codes folder into the cloned folder. Now edit the copy in the cloned folder, stage it, commit it, and push. You can do those steps through VS Code's source control interface or with Git commands. You don't need to drag the file onto the website each time.

That copy and the original in codes will be separate files. Once you've checked everything is where you want it, use one folder as your working folder so you don't accidentally edit the other copy.

local__weather_report:

So cloning doesn't automatically connect my existing codes folder?

31h!awning_76:

Right. It creates a separate local repository in the location you choose. Copying files over is a straightforward way to bring your existing work into it.

Reply to this answer
w264~socket

You can also turn your existing codes folder into a Git repository with git init and add the GitHub repository as a remote. That avoids maintaining a second working folder, but adding a remote doesn't automatically combine the files or histories.

Since the GitHub repository already has content, get comfortable with fetching and integrating its history before trying this route. If both sides have separate initial commits, combining them needs extra care. Cloning first is often less confusing for a beginner.

Reply to this answer
+violet!on~standby

Try a tiny experiment in the cloned folder. Run git status before and after creating a file, then use git add, git commit and git push. Run git status again at each step. Git diff can also show unstaged changes to tracked files.

The terminal makes the stages easier to see, but VS Code is using the same Git concepts. Neither tool sends every edit to GitHub automatically.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions