Settings for the default working path (HOME) of Git for Windows

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.