GitConfiguration operations in
1. Three locations for storing configuration files
-
1. Project profile: The current project takes effect and the other projects don’t take effect
Git config --local user. Name "bulala" git config --local user. Email "[email protected]" // 🌵 vim .git/configCopy the code
-
2. Global configuration files:
Name "bulala" git config --global user.email "[email protected]" // 🌵 vim ~/.gitconfigCopy the code
-
3. System configuration file
// 🌵 Settings: Root permission is required for the following commands, Git config --system user.name "bulala" git config --system user.email "[email protected]" // 🌵 /etc/.gitconfigCopy the code
🤪 is usually used more than 1 and 2
2.Git secret-free login
Three forms:
-
In the URL: You can add the user name and password to the URL to implement the login without password
The original address: modify the original address: https://gitee.com/dbhotlovelife/dbhot.git https:// username: password @ gitee.com/dbhotlovelife/dbhot.git git remote add origin https:// username: password @ gitee.com/dbhotlovelife/dbhot.gitCopy the code
-
SSH:
1. Generate public and private keys (the generated public and private keys are stored in ~/.ssh by default) // Public key ~/.ssh/id_rsa.pub // private key ~/. Copy the public key content and set it to github cat ~/.ssh/id_rsa.pub 3. Git remote add Origin + SSH addressCopy the code
-
Git automatically manages the credentials:
3. Gitignore ignores files:
Gitignore: // Create a.gitignore file in your project directory and edit vim. gitignore // // Ignore the.gitignore file itself *.h // ignore all.h ending files/ / ignore the contents of the fiels folderCopy the code
Some projects have a local database, management only want to push the code does not want to push the database, then need to use Gitignore to handle
Github gitignore address: github.com/github/giti…