bazz
bazz

Reputation: 276

Confusion with setting up a remote git repository

I would like to use git as a source control system for my project work. I have read a number of online tutorials including the git website itself but I am still confused as to how to proceed.

If my code is contained in a main directory, with each project I write created in its own subdirectory, how do I proceed in setting up a git repository? Should I great a separate repository in for each project in its own directory, or can I create one in the main parent directory? Is it normal to have to run git init in every project directory? If this is the case, must I also have multiple repositories on the remote server that I would like to install git on also?

The tutorials I have read make it very clear to me how I would use git for a single project but I am confused as to how I would create a remote repository for all of my projects. Any helpful explanations would be very helpful as I am still unclear after reading 3 online tutorials

Upvotes: 1

Views: 156

Answers (2)

sjakubowski
sjakubowski

Reputation: 2943

There are many reasons to have separate projects in each repo as per @Greg's answer, but if your projects are all directly linked[1] , you can also create a single repo and just deal with each project as a folder in your git repo.

[1] (or not, though the reasons to do this now are weaker (Single vs multiple))

Upvotes: 0

Greg Hewgill
Greg Hewgill

Reputation: 992767

Yes, normally you create one repository per project, instead of trying to collect all projects into one repository.

Unlike some other source control systems (Subversion, for example), cloning a repository in Git gets the whole repository. So limiting a repository to one project prevents having to clone too much stuff when you just want one project. (There are many other reasons why one project per repository is preferred, too.)

Upvotes: 2

Related Questions