4.1 KiB
| sidebar_position | title |
|---|---|
| 5 | Git and Repository |
Git and Repository
Step 7 — Install and Configure Git
7.1 — Install Git
- Install Git if not already installed. Download from here.
- Run the installer. When prompted for the default editor, choose whichever you are comfortable with (Notepad is fine for occasional use).
- On the "Adjusting your PATH environment" screen, select "Git from the command line and also from 3rd-party software" — this makes Git available in CMD, PowerShell, and Cygwin.
- Complete the rest of the installation with default settings.
- Verify the installation by opening a new terminal and running:
git --version
7.2 — Configure Your Identity
Git requires a name and email to be set before you can make any commit. These are embedded in every commit you create and must match your Gitea identity.
git config --global user.name "Your Full Name"
git config --global user.email "your.email@company.com"
Use the same email address as your Gitea account.
7.3 — Configure Line Endings
This is a critical setting for the team. Incorrect line ending configuration causes unnecessary diffs, pollutes commit history, and can break file parsing on the server side.
Run the following commands exactly as written:
git config --global core.autocrlf false
git config --global core.eol lf
| Setting | Value | Reason |
|---|---|---|
core.autocrlf |
false |
Disables automatic line ending conversion. Git will not touch line endings on checkout or commit. |
core.eol |
lf |
Enforces LF (\n) as the line ending for all files in the working tree, consistent with the server and Linux environments. |
⚠️ Do not skip this step. If
autocrlfis left at its Windows default oftrue, Git will silently convert all line endings to CRLF on checkout and back to LF on commit. This causes every file to appear modified on Windows even when no real changes were made.
7.4 — Configure Default Branch Name
The team uses master as the default branch name. Set this to avoid a mismatch when creating new local branches:
git config --global init.defaultBranch master
7.5 — Verify Your Configuration
Run the following to confirm all settings were applied correctly:
git config --global --list
You should see at minimum:
user.name=Your Full Name
user.email=your.email@company.com
core.autocrlf=false
core.eol=lf
init.defaultbranch=master
Step 8 — Clone the Project Repository
- Open a terminal and clone the Stock repository:
git clone http://145.239.66.197:3000/TrizTech/TrizStockRepository.git
- When prompted, enter your Gitea username and password (or token if your Gitea instance requires it).
- Navigate into the project folder:
cd TrizStockRepository
Step 9 — Configure database.properties
The database.properties file contains the local database connection settings. It is never stored in the repository for security reasons. You need to create it manually.
- Download the template from the team resources repository.
- Copy the template into the correct location inside your local repository:
\src\main\resources\database.properties
- Open the file in any text editor and fill in your local values:
db.host=localhost
db.port=1433
db.name=TrizStockLife
db.username=YOUR_DB_USERNAME
db.password=YOUR_DB_PASSWORD
- Verify that
database.propertiesis listed in the project's.gitignore:
# In the project root, open .gitignore and confirm this line exists:
database.properties
If it is not there, add it. Never commit this file.