{{Header}}
{{title|title=
git - Distributed Version Control System
}}
{{#seo:
|description=Put folder under Git Version Control / git symlinks
|image=Git-logo.svg
}}
[[File:Git-logo.svg|200px|thumb|Git logo]]
{{intro|
Put folder under Git Version Control / git symlinks
}}
= Introduction =
{{stub}}
= Put folder under Git Version Control =
[[Operating System Software and Updates]]
{{CodeSelect|code=
sudo apt update
}}
Install <code>git</code>.
{{CodeSelect|code=
sudo apt install --no-install-recommends git
}}
Unless you want to use git for pushing changes to remotes which you probably won't in a testing VM you can use the following git config without using any real names or pseudonyms. (These are the git suggested defaults. <ref>
<pre>
git commit -a -m .
*** Please tell me who you are.
Run
git config --global user.email "
[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: empty ident name (for <(null)>) not allowed
</pre>
</ref>)
{{CodeSelect|code=
git config --global user.email "
[email protected]"
}}
{{CodeSelect|code=
git config --global user.name "Your Name"
}}
Initialize git in current folder or <code>cd</code> to any folder you want to put under git version control. Can even be done for <code>/home/user</code> folder which is very useful.
{{CodeSelect|code=
git init
}}
Add all files to be added for next commit.
{{CodeSelect|code=
git add -A
}}
Actually commit to git.
{{CodeSelect|code=
git commit -a -m .
}}
Check git status of that folder.
{{CodeSelect|code=
git status
}}
No changes registered yet to the folder since just now committed all to git.
<pre>
On branch master
nothing to commit, working tree clean
</pre>
Create a test file or do some activity such as starting a browser or e-mail client.
{{CodeSelect|code=
touch test-file
}}
Check again git status of that folder.
{{CodeSelect|code=
git status
}}
Now git will show what changed.
<pre>
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
test-file
nothing added to commit but untracked files present (use "git add" to track)
</pre>
= git symlinks =
git configuration file {{CodeSelect|inline=true|code=
~/.gitconfig
}}:
{{CodeSelect|code=
[core]
symlinks = false
}}
<code>symlinks = false</code> is more secure:
*
https://nvd.nist.gov/vuln/detail/cve-2021-21300
*
https://nvd.nist.gov/vuln/detail/cve-2024-32002
Use:
* Developers: Are more likely to use <code>symlinks = false</code> in <code>~/.gitconfig</code>.
* Users that build from source code: Are more likely to not use any <code>~/.gitconfig</code> file, therefore using git's default <code>symlinks = true</code>.
When not using <code>symlinks = false</code>:
* <code>find "." -type l -not -iwholename '*.git*'</code> will not detect these files as symlinks.
* These are detected as file without newline at the of file. Example:
** {{CodeSelect|inline=true|code=
file qubes/qubes-template-whonix/whonix-workstation
}}
<pre>
qubes/qubes-template-whonix/whonix-workstation: ASCII text, with no line terminators
</pre>
When using <code>symlinks = false</code>:
* <code>find "." -type l -not -iwholename '*.git*'</code> will detect these files as symlinks.
* These are detected as symlink. Example:
** {{CodeSelect|inline=true|code=
file qubes/qubes-template-whonix/whonix-workstation
}}
<pre>
qubes/qubes-template-whonix/whonix-workstation: symbolic link to whonix-gateway
</pre>
Potential issues:
* A text file versus a symbolic link can cause different build results depending on git settings, leading to bugs and/or package reproducibility issues.
* Git will translate symlink replacement text files back into symlinks when committing and pushing, meaning if you attempt to change a symlink to a real file, people who pull the repo will get a dangling symlink pointing to a very strange filename rather than getting a normal file with contents.
= Footnotes =
{{reflist|close=1}}
{{Footer}}
[[Category:Documentation]] [[Category:Design]]