Does git remote add origin need to be configured separately for each local repository?

I’m working with multiple git repositories on my local machine and I’m confused about how remote origins work. Let’s say I have two different projects in separate folders on my computer.

Can I set up different remote repositories for each project like this:

/project-alpha$ git remote add origin [email protected]:myusername/alpha-repo
/project-beta$ git remote add origin [email protected]:myusername/beta-repo

I want to understand where this remote configuration gets saved. Is it stored locally within each project folder or does it go into some global git configuration file on my system? I need to make sure each project connects to its correct GitHub repository without any conflicts.

exactly! remote configs are per-repo, not global. pro tip - if u forget which remote u’ve set up, just run git remote -v from that project folder. has saved me tons of headaches when juggling multiple repos.

Yes, remote configs are repository-specific - they’re stored in each project’s .git/config file, not globally. Your setup approach is spot on. Both projects will keep separate remote connections without any interference. When you run git init, it creates an isolated .git directory with all the repo metadata, including remote configs. Want to see this yourself? Navigate to either project folder and check .git/config after adding your remotes. You’ll see sections like [remote "origin"] with the URL. This isolation means pushing from project-alpha will never accidentally mess with project-beta, even if you’ve got multiple terminal windows open working on different repos.

yep, each local repo has its own .git/config file. so your alpha and beta projects will each have their own remotes and don’t mess each other up! they’re totally separate, no worries there.

Yeah, each repo needs its own remote setup. The config sits in each project’s .git folder.

Managing multiple repos manually sucks when you’ve got dozens of projects though. Been there.

I automated the whole thing. New project? My workflow creates the GitHub repo, sets up the remote, pushes initial commits, and configures branch protection rules automatically.

You can build something that watches for new project folders and handles git remote setup automatically. No more typing the same commands repeatedly. Just create your project folder and let automation do the boring work.

I use Latenode for workflow automation. It connects to GitHub’s API and handles repetitive git operations across multiple projects. Way better than manual setup every time.

Yes, you need to set up remotes separately for each project. Remote configurations are stored in each repository’s .git/config file. Thus, when you execute git remote add origin in project-alpha, it only impacts that specific project, leaving project-beta unaffected. I have managed numerous repositories this way for years without encountering issues. Each repository maintains its own remotes, branches, and commit histories, ensuring clear separation. You can verify this by running git remote -v in each project folder, which will display different URLs, preventing any mix-up of unrelated projects.