我曾经在OS X机器上安装了较旧版本的Git,但是后来我将系统升级到OS X 10.11,并通过Apache安装了较新版本的Git(2.6.4)和Git HTTP停止工作。
我在apache_error.log
文件中出现以下错误:
[Thu Apr 28 08:41:37 2016] [error] [client ::1] error: Could not expand include path '~/.gitcinclude'
[Thu Apr 28 08:41:37 2016] [error] [client ::1] fatal: bad config file line 49 in /usr/local/git/etc/gitconfig
Run Code Online (Sandbox Code Playgroud)
该gitconfig
文件的内容为:
[core]
excludesfile = ~/.gitignore
legacyheaders = false # >git 1.5
quotepath = false
# http://stackoverflow.com/questions/136178/git-diff-handling-long-lines
pager = less -r
# if ? doesn’t work, try: pager = less -+$LESS -FRX
[user]
# name = your name
# email = your@name
[mergetool]
keepBackup = true
[push]
default = simple # [ matching | simple ]
[color]
ui = auto
interactive = auto
[repack]
usedeltabaseoffset = true # >git 1.5
[alias]
s = status
a = !git add . && git status
au = !git add -u . && git status
aa = !git add . && git add -u . && git status
c = commit
cm = commit -m
ca = commit --amend # careful
ac = !git add . && git commit
acm = !git add . && git commit -m
l = log --graph --all --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset'
ll = log --stat --abbrev-commit
lg = log --color --graph --pretty=format:'%C(bold white)%h%Creset -%C(bold green)%d%Creset %s %C(bold green)(%cr)%Creset %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
llg = log --color --graph --pretty=format:'%C(bold white)%H %d%Creset%n%s%n%+b%C(bold blue)%an <%ae>%Creset %C(bold green)%cr (%ci)' --abbrev-commit
d = diff
master = checkout master
spull = svn rebase
spush = svn dcommit
alias = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\\t => \\2/' | sort
[include] # as of 1.7.10 https://github.com/git/git/commit/9b25a0b52e09400719366f0a33d0d0da98bbf7b0
path = ~/.gitcinclude
path = .githubconfig
path = .gitcredential
#[github]
# user =
# token =
[diff]
# git does copy/rename *detection*. if you want it to track copies/renames:
# http://stackoverflow.com/questions/1043388/record-file-copy-operation-with-git
# renames = copies
[diff "exif"]
textconv = exif
[credential]
helper = osxkeychain
Run Code Online (Sandbox Code Playgroud)
我在Google上搜索了很多,发现的是以下帖子https://software.intel.com/en-us/forums/intel-xdk/topic/600175/#node-600175(实际上是标记为的帖子BEST REPLY
),其中用户说必须在该gitconfig
文件中执行以下操作:
There's two things in the config file to edit....
Under the [core] heading :
excludesfile = ~/.gitignore
change to....
excludesfile = /Users/kevin/.gitignore
and under [include] change :
path = ~/.gitcinclude
change to...
path = /Users/kevin/.gitcinclude
(change "kevin" to your user profile name ;)
Run Code Online (Sandbox Code Playgroud)
我在gitconfig中更改了这些行,并替换~/
为/Users/myuser/
:
[core]
excludesfile = /Users/myuser/.gitignore
legacyheaders = false # >git 1.5
quotepath = false
# http://stackoverflow.com/questions/136178/git-diff-handling-long-lines
pager = less -r
# if ? doesn’t work, try: pager = less -+$LESS -FRX
[user]
# name = your name
# email = your@name
[mergetool]
keepBackup = true
[push]
default = simple # [ matching | simple ]
[color]
ui = auto
interactive = auto
[repack]
usedeltabaseoffset = true # >git 1.5
[alias]
s = status
a = !git add . && git status
au = !git add -u . && git status
aa = !git add . && git add -u . && git status
c = commit
cm = commit -m
ca = commit --amend # careful
ac = !git add . && git commit
acm = !git add . && git commit -m
l = log --graph --all --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset'
ll = log --stat --abbrev-commit
lg = log --color --graph --pretty=format:'%C(bold white)%h%Creset -%C(bold green)%d%Creset %s %C(bold green)(%cr)%Creset %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
llg = log --color --graph --pretty=format:'%C(bold white)%H %d%Creset%n%s%n%+b%C(bold blue)%an <%ae>%Creset %C(bold green)%cr (%ci)' --abbrev-commit
d = diff
master = checkout master
spull = svn rebase
spush = svn dcommit
alias = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\\t => \\2/' | sort
[include] # as of 1.7.10 https://github.com/git/git/commit/9b25a0b52e09400719366f0a33d0d0da98bbf7b0
path = /Users/myuser/.gitcinclude
path = .githubconfig
path = .gitcredential
#[github]
# user =
# token =
[diff]
# git does copy/rename *detection*. if you want it to track copies/renames:
# http://stackoverflow.com/questions/1043388/record-file-copy-operation-with-git
# renames = copies
[diff "exif"]
textconv = exif
[credential]
helper = osxkeychain
Run Code Online (Sandbox Code Playgroud)
然后,基于HTTP的Git开始工作。有人可以告诉我我的Git安装出了什么问题吗,或者这可能是我已安装的Git版本的错误?
正如我所说,我已经从官方网站https://git-scm.com/download/mac安装了Git ,版本为2.6.4。
Apache / Git HTTP配置:
#
# Git over HTTP configuration
#
SetEnv GIT_PROJECT_ROOT /Users/git/GitRepositories
#
# Uncomment if you want Git to serve all repos, even those without git-daemon-export-ok inside of them.
#
SetEnv GIT_HTTP_EXPORT_ALL
#
# Tell Apache that anything coming into the /git path will be handled by git http-backend
#
ScriptAlias /git/ /usr/local/git/libexec/git-core/git-http-backend/
#
# Tell Apache to allow requests to that path
#
<Directory "/usr/local/git/libexec/git-core*">
Options ExecCGI Indexes
Order allow,deny
Allow from all
</Directory>
#
# Authenticated git push
#
<LocationMatch "^/git/.*/git-receive-pack$">
AuthType Basic
AuthName "Git Access"
AuthUserFile /Users/git/.htpasswd
Require valid-user
</LocationMatch>
Run Code Online (Sandbox Code Playgroud)
所有存储库都位于系统用户的目录中/Users/git/GitRepositories
,该目录git
不是myuser
user,但是我不认为这是问题所在,因为它在我更新Git之前就可以正常工作。
如果有人可以澄清这种行为,我将不胜感激。
感谢您的关注。
小智 8
我在位于以下位置的gitconfig文件中进行了以下更改 /usr/local/git/etc/gitconfig
在[core]标题下:
excludesfile = ~/.gitignore
Run Code Online (Sandbox Code Playgroud)
改成....
excludesfile = /Users/username/.gitignore
Run Code Online (Sandbox Code Playgroud)
在[include]更改下:
path = ~/.gitcinclude
Run Code Online (Sandbox Code Playgroud)
改成...
path = /Users/username/.gitcinclude
Run Code Online (Sandbox Code Playgroud)
这对我有用。我不再收到错误。
继 Mayur/Arun 和 gwk 的回答之后,我使用 '$HOME' 代替了绝对路径,它为我解决了这个问题。我没有在各种场景中测试过这个,但它确实解决了我面临的问题。天啊。
使用 Mayur/Arun 的格式我的文件更改是:
在[core]
标题下:
excludesfile = ~/.gitignore
Run Code Online (Sandbox Code Playgroud)
改成....
excludesfile = $HOME/.gitignore
Run Code Online (Sandbox Code Playgroud)
并在[include]
改变:
path = ~/.gitcinclude
Run Code Online (Sandbox Code Playgroud)
改成...
path = $HOME/.gitcinclude
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3615 次 |
最近记录: |