简体   繁体   English

Git默认主目录包含拼写错误,我该如何更改?

[英]Git default home directory includes a typo, how can I change it?

When I first open git bash my $HOME is set to "/c/Users/ds420%", however there is no % in the actual directory so when directories are supposed to be created automatically I get an error, for example: 当我第一次打开git bash时,我的$ HOME设置为“/ c / Users / ds420%”,但实际目录中没有%,因此当应该自动创建目录时,我会收到错误,例如:

$ ssh -T git@github.com
Could not create directory '/c/Users/ds420%/.ssh'.
percent_expand: unknown key %/

and even 乃至

$ cd ~
bash: cd: /c/Users/ds420%: No such file or directory

I have tried HOME=/c/Users/ds420 and that fixes the second code snippet but it doesn't seem to have an effect on what Git thinks HOME is. 我已经尝试了HOME = / c / Users / ds420并修复了第二个代码片段,但它似乎没有影响Git认为HOME是什么。 I also tried setting GIT_DIR and XDG_CONFIG_HOME based on similar stack overflow problems, none of those helped. 我也尝试根据类似的堆栈溢出问题设置GIT_DIR和XDG_CONFIG_HOME,这些都没有帮助。

Is there a way to either input HOME to the ssh function or to change it more permanently? 有没有办法将HOME输入到ssh功能或更永久地更改它? Can anyone tell me why the % might have appeared in the first place? 谁能告诉我为什么%可能首先出现?

change the $HOME environment variable to your user home. 将$ HOME环境变量更改为您的用户主页。 To do this automatically when git bash is started run the following command: 要在启动git bash时自动执行此操作,请运行以下命令:

$ echo "HOME=\"YourHomeDir\"" > .bashrc

replace YourHomeDir with /c/Users/your_windows_username 替换YourHomeDir/c/Users/your_windows_username

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM