Git 使用心得

本文解答了关于Git忽略列表配置、忽略条目不生效的原因及解决方法、提交时遇到的权限错误处理方式,以及通过GitGUI打开GUI界面时出现异常错误的解决办法。

1、如何配置忽略列表?

  Git 通过库的工作区根目录下的 .gitingnore 文件配置忽略列表,每行一句忽略表达式。

2、我确定忽略表达式没有语法错误,但为什么忽略条目不生效?

  如果该条目对应的文件已加入版本库,则该文件的如果更改了也总是会出现在变更列表当中。只有将该文件从库中删除了,该忽略条目才会使Git停止对该文件的跟踪。

3、提交错误

  update-ref 失败:

  error: Unable to append to .git/logs/refs/heads/<your projectName>: Permission denied

  fatal: cannot update the ref 'HEAD'.

  解决:这是通过Git GUI进行提交时发生的错误,由 .git 文件夹中的文件被设为“只读”所致,将 .git 文件夹下的所有文件、文件夹及其子文件的只读属性去掉即可。

4、msysgit : 通过 Git GUI 快捷菜单打开 GUI 界面时提示 child process exited abnormally 错误的解决方法

 错误日志如下:

child process exited abnormally
child process exited abnormally
while executing
"exec {C:/Program Files/Git/libexec/git-core/git-config.exe} --global --unset gui.recentrepo {^C:/test1$}"
("eval" body line 1)
invoked from within
"eval exec $opt $cmdp $args"
(procedure "git" line 23)
invoked from within
"git config --global --unset gui.recentrepo "^$p\$""
(procedure "_unset_recentrepo" line 3)
invoked from within
"_unset_recentrepo [lindex $recent 0]"
(procedure "_append_recentrepos" line 19)
invoked from within
"_append_recentrepos [pwd]"
(procedure "_git_init" line 17)
invoked from within
"_git_init $this"
(procedure "choose_repository::_do_clone2" line 36)
invoked from within
"choose_repository::_do_clone2 ::choose_repository::__o1::__d"
invoked from within
".buttons.next invoke"
("uplevel" body line 1)
invoked from within
"uplevel #0 [list $w invoke]"
(procedure "tk::ButtonUp" line 24)
invoked from within
"tk::ButtonUp .buttons.next"
(command bound to event)

 解决方法:

  该错误是由于全局的 .gitconfig 文件中 [gui] 下配置了多个 recentrepo 配置项引起的,该项最多只能配置一项。

  配置文件位于 %HOMEDRIVE%%HOMEPATH%\.gitconfig ,在 windows 下即为 C:\Documents and Settings\%CurrentUser%\.gitconfig 。

  打开该文件,把 [gui] 下重复的 recentrepo 配置项删除,只保留一项或删除全部的 recentrepo 配置,保存文件即可。

转载于:https://www.cnblogs.com/haiq/archive/2011/03/01/1968151.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值