Git 使用心得

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 配置,保存文件即可。

posted @ 2011-03-01 17:00  haiq  阅读(14339)  评论(0编辑  收藏  举报