Prerequisites: Install Git on Debian
Before integrating Git with PhpStorm, ensure Git is installed on your Debian system. Run the following commands in the terminal:
sudo apt update
sudo apt install git
Verify the installation by checking the version:
git --version
This should output the installed Git version (e.g., git version 2.45.1).
Step 1: Configure Global Git User Info
Set your name and email in Git (required for commits). Run these commands in the terminal:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
These credentials will be used for all Git operations (e.g., commits, pushes).
Step 2: Set Up Git in PhpStorm
File > Settings (Linux/Windows) or PhpStorm > Preferences (macOS).Version Control and select Git./usr/bin/git. Click the Test button to confirm PhpStorm can recognize Git.Apply and then OK to save the configuration.Step 3: Enable Version Control for Your Project
VCS > Enable Version Control Integration.Git from the dropdown and click OK. This links your project to Git.Step 4: Initialize a Git Repository (If Needed)
If your project isn’t already a Git repository:
Project view.Git > Init Repository.OK. PhpStorm will create a .git folder in your project root.Step 5: Connect to a Remote Repository (Optional but Common)
To push/pull code from a remote repository (e.g., GitHub, GitLab):
VCS > Git > Remotes.+ button to add a new remote.origin) and the remote repository URL (e.g., https://github.com/username/repo.git).OK to save.Step 6: Perform Basic Git Operations in PhpStorm
Commit Changes:
Git > Commit Directory.Commit.Push Changes:
Git > Repository > Push.Push.Pull Changes:
Git > Pull.View Version Control History:
Use the Version Control panel (bottom of PhpStorm) to see file changes, commit history, and branch status.
Optional: Configure SSH Keys for Remote Repositories
For secure authentication with remote repositories (recommended over HTTPS), set up SSH keys:
ssh-keygen -t ed25519 -C "your.email@example.com"
Press Enter to save the key to the default location (~/.ssh/id_ed25519).Settings > SSH and GPG Keys > New SSH Key).ssh -T git@github.com
You should see a success message (e.g., Hi username! You've successfully authenticated).By following these steps, you’ll have fully integrated Git with PhpStorm on Debian, enabling efficient version control for your projects.