git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/6] gittutorial doc: replace "alice" and "bob" with "you" and "www-data"

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jun 17, 2021, 20:38 UTC
Message-ID
<875yyc5i6x.fsf@evledraar.gmail.com>
In-Reply-To
<8250d8af-2d52-321c-36a7-d71c29fc1ef1@gmail.com>
On Wed, Jun 16 2021, Bagas Sanjaya wrote:
Show 27 quoted lines
> On 15/06/21 23.17, Ævar Arnfjörð Bjarmason wrote:
>> -Suppose that Alice has started a new project with a Git repository in
>> -/home/alice/project, and that Bob, who has a home directory on the
>> -same machine, wants to contribute.
>> +Suppose that you've started a new project with a Git repository in
>> +/home/you/project, and you'd like another user on the same local
>> +machine to be able to contribute to it. E.g. a www-data user to serve
>> +the content up with a webserver.
>>   -Bob begins with:
>> +As the `www-data` user do:
>>    >   ------------------------------------------------
>> -bob$ git clone /home/alice/project myrepo
>> +www-data$ git clone /home/you/project /var/www-data/deployment
>>   ------------------------------------------------
>> 
>
> This assumes that we're on Debian or its derivatives, however many
> users run Git on other distributions (Fedora, Arch, Gentoo, openSUSE,
> etc.), so `www-data` user may not be present there. Also, `www-data`
> is system account, as opposed to normal user account, so you can't log
> in to it; you need as root `chown -R www-data:www-data /somewhere/`.
>
> This also assumes that we use Apache HTTPD. The setup for other
> webservers may be different. For example, if NGINX is used (installed 
> from upstream packages rather than from Debian package repository),
> you need to make site root (the path specified in `root` directive)
> readable by `nginx` user.

I meant www-data merely as an example, the user is expected to fill in the blanks as Junio noted downthread. Not all *nix systems even have $HOME in /home.

But clearly it's confusing to some, do you think calling it s/www-data/website/g and otherwise making it non-distro specific would be better?

Show 10 quoted lines
>> -This creates a new directory "myrepo" containing a clone of Alice's
>> +This creates a new directory "deployment" containing a clone of your
>>   repository.  The clone is on an equal footing with the original
>>   project, possessing its own copy of the original project's history.
>>  
>
> But the scenario is we're cloning from local repo, so `git clone` here
> implies --local (and bypasses normal Git transport mechanism), so to
> get clone experience similar to when using remote repo, we can use 
> --no-local instead.

Well spotted, I believe that was the behavior when this was writen at 927a503cd0 (New tutorial, 2006-01-22), so this bug has probably always been there...

Show 25 quoted lines
>> -Bob then makes some changes and commits them:
>> +As `www-data` you then makes some changes and commit them:
>>     ------------------------------------------------
>>   (edit files)
>> -bob$ git commit -a
>> +www-data$ git commit -a
>>   (repeat as necessary)
>>   ------------------------------------------------
>>   -When he's ready, he tells Alice to pull changes from the
>> repository
>> -at /home/bob/myrepo.  She does this with:
>> +You can then pull those changes to the checkout in your home directory
>> +at /home/you/project:
>>     ------------------------------------------------
>> -alice$ cd /home/alice/project
>> -alice$ git pull /home/bob/myrepo master
>> +you$ cd /home/you/project
>> +you$ git pull /var/www-data/deployment master
>>   ------------------------------------------------
>>   
>
> The resulting rewrite until this point makes no sense for
> me. Previously we have Alice and Bob working the project, but now you
> do the same, one as normal user account and one as system user
> `www-data`. Honestly I would like keeping the status quo.

Collectively we're a sample size of two, so it doesn't say much either way, but FWIW I've worked at two companies in the past that had some version of the pattern discussed in this article. I.e. you'd login to some machine, have a repo in $HOME, and used that as your staging area to another repo on the same machine also under your control (either permanently or exclusively, or you'd "lock" it for the duration).

I don't think I've once in all my time using git been in the position to be logged into a machine, and pulling/pushing to another repo in someone else's $HOME or equivalent.

In any case, I do think for the purposes of the example in the guide replacing Alice & Bob with You & another version of you removes a lot of potential confusion, we don't need to cover permissions, the other user doing unexpected things like non-ff updates, pruning branches you may have relied on through the --local clone etc.

It's implicit that both "users" are you, so we only have to discuss the point of the actual example, how to pull and push between two different repos, the "different users" in this case was always a distraction.

Previous: Felipe ContrerasNext: Ævar Arnfjörð Bjarmason
Message 6 of 24 in “doc: replace "alice" and "bob" examples”
  1. 0/6 doc: replace "alice" and "bob" examplesÆvar Arnfjörð Bjarmason, Jun 15, 2021
  2. 1/6 gittutorial doc: replace "alice" and "bob" with "you" and "www-data"Ævar Arnfjörð Bjarmason, Jun 15, 2021
  3. Bagas SanjayaJun 16, 2021
  4. Junio C HamanoJun 16, 2021
  5. Felipe ContrerasJun 16, 2021
  6. Ævar Arnfjörð BjarmasonJun 17, 2021
  7. 2/6 gitcvs-migration doc: replace "alice" and "bob" with "you" and "www-data"Ævar Arnfjörð Bjarmason, Jun 15, 2021
  8. Bagas SanjayaJun 16, 2021
  9. 3/6 daemon doc + code comments: reword "alice" exampleÆvar Arnfjörð Bjarmason, Jun 15, 2021
  10. 4/6 fast-import doc: change "bob" in an example to "file.txt"Ævar Arnfjörð Bjarmason, Jun 15, 2021
  11. 5/6 doc: replace "alice" and "bob" with "jdoe" and "msmith"Ævar Arnfjörð Bjarmason, Jun 15, 2021
  12. 6/6 pack-protocol doc: use "www-data" in place of "alice"Ævar Arnfjörð Bjarmason, Jun 15, 2021
  13. Robert P. J. DayJun 15, 2021
  14. Ævar Arnfjörð BjarmasonJun 15, 2021
  15. Felipe ContrerasJun 15, 2021
  16. Ævar Arnfjörð BjarmasonJun 15, 2021
  17. Felipe ContrerasJun 16, 2021
  18. Phillip SusiJun 17, 2021
  19. Ævar Arnfjörð BjarmasonJun 17, 2021
  20. Junio C HamanoJun 16, 2021
  21. Robert P. J. DayJun 16, 2021
  22. Jeff KingJun 16, 2021
  23. Felipe ContrerasJun 16, 2021
  24. Randall S. BeckerJun 16, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.