1. Install and configure the default path
Windows from github above: https://git-for-windows.github.io/download after installing git (double click, change the required installation path, all the way OK), the installation process can refer to the Liaoche git tutorial/http/ www.liaoxuefeng.com/. The default HOME
and ~
path are generally C:\Users\用户名
, and each time you have to switch to a common repository with a command, this operation is repetitive and meaningless. More importantly, if you use a SSH
connection to GitHub, its configuration file, such as. SSH, is also stored in the C drive, which is not conducive to backup.
Open Git安装位置\etc\profile
the file and find:
# normalize HOME to UNIX pathhome="$HOME" ; PWD)"export PATH="$HOME/bin: $PATH"
Add two lines and modify the result as follows (insert new content at the end If not):
# normalize home to UNIX pathhome=" you want to modify the home path "Home=" "$HOME" ; PWD)"cdexport PATH="$HOME/bin: $PATH"
Restart Git bash and it will automatically enter the newly modified HOME
path.
For your convenience, you can add a variable name to your custom project directory, which is not only convenient for path jumps, but also for automatically entering the project directory when you start Git. The method is extremely simple, just include in the profile
file:
Set Project Path proj=" your project file directory "
2. The SSH protocol between git and GitHub:
Run the following command:
$ ssh-keygen-t rsa-c "[Email protected]"
You can see:
The purple part is exactly the same, the previous custom path is the same as the home path you set, so you can customize where your SSH public and private keys are saved.
Settings for the default working path (HOME) of Git for Windows