Alice/_en_/_posts/2020-02-28-Transforming-dir...

1.5 KiB

layout author title lang lang-ref
post Flávio Schiavoni Transforming directories into versioned repositories en Transforming-directories-into-versioned-repositories

A code repository, quite broadly, is a directory that contains files that have version control. This includes the possibility of auditing file changes, checking for possible changes from one version to another and even returning the file to a previous version.

Although we are used to using remote repositories, such as github or another similar service, it is possible with git to maintain any local directory as a versioned repository. This allows to audit modifications and guarantees a certain security because it would allow to check all previous versions of a file.

To transform a directory into a git repository, use the command:

git init  --bare --shared
  • --bare initialize the git repository to be a remote repository
  • --shared sets write permissions for group

Once the repository is started, it is necessary to add all files to it:

git add *

Then, you need to identify yourself:

git config --global user.email "alice@alice.dcomp.ufsj.edu.br"
git config --global user.name "Alice"

Finally, submit the changes with the command:

 git commit -m "Versão inicial do projeto"

With this, with each modification you want to save, just add the changed files and commit.

More information: [https://git-scm.com/book/en/v2/Git-on-the-Server-Getting-Git-on-a-Server]