Is there a preferred way where I should initialize my Git repository on Mac OS X?

Where should I build my repositories? My repos tutorials went deep, but I thought that since I will have a test of my production site, I have to build them in ~/sites/ .

This may seem trivial, but most of the Git ideas I've seen do not actually indicate a specific location.

+6
source share
1 answer

When you work with Git, there are several repositories you can work with.

Firstly, there is a local repository. This is the complete repository that lives on your local system. You must have a local repository to use Git, and everyone who works with this project will have a copy of this repository locally on their system. This works git.

Put this local repository where you want to work. In Subversion terms, think of it as a working directory. I have $HOME/workdir when I work on all my projects. Some of these are Subversion working directories (e.g. ~/workdir/verbox/trunk ). Some of them are local Git repositories. ( ~/workdir/git-box ). Thus, all my work is in one central place.

Then the project may have different remote repositories. These are the repositories that others have where you click and retrieve information. The best part about Git is that it's not necessarily a master repo. Each has a local repository, and you can pull or modify your changes in other repositories. For example, let's say you are working on a project with Bob. Bob, and you will have a local Git repository for this project. When you want Bob to see your changes, you make your changes to Bob's local repository. If you want Bob changes, you pull Bob changes from your repository.

You may have another repository on Github where your code will be released. Both Bob and you click and paste your changes into and out of this repository. There is no master repo. Just repositories that have a common history and can share with each other.

Speaking of GitHub, if you want your project to be publicly available, creating a Github project is a good idea. No need to worry about administration or firewalls, etc.

If you need a public Git repository for your project on your Mac (something that I would not recommend for), set up a new user. Configure SSH keys for each user who has access to this repository, configure the Mac firewall to allow remote logon. And put a copy of your repository for this user. Also set this default shell for the user to /bin/false . You do not want people to do anything with this user other than clicking or pulling their changes to this repository.

So, what about this Site directory in your $HOME directory? When OS X first appeared, the idea came up that web developers would be attracted to it (true) and that they would want to run Apache httpd daemon on the system. By default, httpd.conf been configured so that each user can have their own web page on the system. For example, http://localhost/~beta208/... If you put the HTTP files under Site , it will be on your local web page.

Turns out this is not how web developers wanted to work. In later versions of Mac OS X, Apache httpd does not start by default, and Site directories are not configured automatically. It turns out that web development includes a wide range of materials, and web developers will set up their own system, thank you very much, without the help of Apple. There is a Site directory, but as a rudimentary organ, in fact it does nothing. New users created with Mac OS X do not receive the Site directory.

+9
source

Source: https://habr.com/ru/post/974228/


All Articles