Problem with setting up Trac 1.0.1 with Git 1.8.3.1 on CentOS 7

207 views
Skip to first unread message

Pascal Dauer

unread,
Aug 21, 2014, 1:37:08 PM8/21/14
to trac-...@googlegroups.com
Hi there,
i installed Trac according to the instructions on http://trac.edgewall.org/wiki/TracInstall and http://trac.edgewall.org/wiki/TracModWSGI .
So far, Trac works just fine.

Now i am trying to get Git working with Trac, but i just wont work and i dont know why. I hop you can help me!

The System informations:
PackageVersion
Trac1.0.1
Genshi0.7 (with speedups)
mod_wsgi3.4 (WSGIProcessGroup WSGIApplicationGroup %{GLOBAL})
MySQLserver: "5.5.37-MariaDB", client: "5.5.37-MariaDB", thread-safe: 1
MySQLdb1.2.5
Python2.7.5 (default, Jun 17 2014, 18:11:42) [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)]
setuptools0.9.8
jQuery1.7.2

What i've done or tried so far:

  1. yum install git
  2. vim /usr/share/trac/projects/mytrac/conf/trac.ini
    1. repository_type = git
    2. [components]
      tracopt.versioncontrol.git.* = enabled 
  3. adduser git
  4. mkdir -p /srv/git/myrepo && cd /srv/git/myrepo
  5. git --bare init --shared=true
  6. chown -R git:git -R /srv/git/myrepo
At this point i can check out and check in changes from anywhere.
Now to the step where i need to connect trac with my repository:
In the admin-panel "Manage Repositories" i add the repository (/srv/git/myrepo) and resync it with "trac-admin /usr/share/trac/projects/mytrac/ repository resync "*"
After this, there should be a "Browse" button in menu. But there isn. No errors are displayed but in the logfile i found this: 

2014-08-21 19:29:00,106 Trac[git_fs] INFO: detected GIT version 1.8.3.1
2014-08-21 19:29:00,107 Trac[PyGIT] ERROR: GIT control files missing in '/srv/git/myrepo'


According to http://trac.edgewall.org/wiki/TracGit i need to set the repository to /srv/git/myrepo/.git. But i dont get a .git directory if i init it with the --bare flag.
Also, i cant push changes to the repository if i dont use the --bare flag.
If i try, i get the following error:

remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To ro...@192.168.1.5:/srv/git/myrepo


And even if i create a repository without the --bare flag, i am getting the same error (GIT control files missing in '/srv/git/myrepo').

Can you please help me out... i dont know what else i can try...

Regards,

Pascal













Ryan Ollos

unread,
Aug 21, 2014, 4:25:22 PM8/21/14
to trac-...@googlegroups.com
The path /srv/git/myrepo appears to be correct. I gave you some bad advice in (1) by not taking note that you were creating a bare repository.

There have been some strange issue reported when "invisible whitespace" is appended to the path (2). I suggest deleting the repository and recreating it by typing in the full path rather than copying and pasting it.

What is the output of?:
$ ls /srv/git/myrepo

Pascal Dauer

unread,
Aug 21, 2014, 6:40:30 PM8/21/14
to trac-...@googlegroups.com
The output of 

ls /srv/git/myrepo
branches  config  description  HEAD  hooks  info  objects  refs 

a bit more information:

ls -a -Z /srv/git/myrepo

drwxrwsr-x. git  git  unconfined_u:object_r:var_t:s0   .
drwxr-xr-x. root root unconfined_u:object_r:var_t:s0   ..
drwxrwsr-x. git  git  unconfined_u:object_r:var_t:s0   branches
-rw-rw-r--. git  git  unconfined_u:object_r:var_t:s0   config
-rw-rw-r--. git  git  unconfined_u:object_r:var_t:s0   description
-rw-rw-r--. git  git  unconfined_u:object_r:var_t:s0   HEAD
drwxrwsr-x. git  git  unconfined_u:object_r:var_t:s0   hooks
drwxrwsr-x. git  git  unconfined_u:object_r:var_t:s0   info
drwxrwsr-x. git  git  unconfined_u:object_r:var_t:s0   objects
drwxrwsr-x. git  git  unconfined_u:object_r:var_t:s0   refs

maybe SELinux is making some trouble?

Like you asked on SO, here my logging section from the trac.ini

[logging]
log_file = trac.log
log_level = DEBUG
log_type = file

---

Deleting and typing the repo path didnt work.

I also tried to config the repository in the trac.ini in the repositories section like this:


[repositories]
project.dir = /srv/git/myrepo
project.description = This should be my repo.
project.type = git

I get the same error...

2014-08-21 23:37:34,623 Trac[PyGIT] ERROR: GIT control files missing in '/srv/git/myrepo'

Ryan Ollos

unread,
Aug 21, 2014, 11:17:59 PM8/21/14
to trac-...@googlegroups.com
On Thu, Aug 21, 2014 at 3:40 PM, Pascal Dauer <dauer....@gmail.com> wrote:
The output of 

ls /srv/git/myrepo
branches  config  description  HEAD  hooks  info  objects  refs 

a bit more information:

ls -a -Z /srv/git/myrepo

drwxrwsr-x. git  git  unconfined_u:object_r:var_t:s0   .
drwxr-xr-x. root root unconfined_u:object_r:var_t:s0   ..
drwxrwsr-x. git  git  unconfined_u:object_r:var_t:s0   branches
-rw-rw-r--. git  git  unconfined_u:object_r:var_t:s0   config
-rw-rw-r--. git  git  unconfined_u:object_r:var_t:s0   description
-rw-rw-r--. git  git  unconfined_u:object_r:var_t:s0   HEAD
drwxrwsr-x. git  git  unconfined_u:object_r:var_t:s0   hooks
drwxrwsr-x. git  git  unconfined_u:object_r:var_t:s0   info
drwxrwsr-x. git  git  unconfined_u:object_r:var_t:s0   objects
drwxrwsr-x. git  git  unconfined_u:object_r:var_t:s0   refs

maybe SELinux is making some trouble?


A permissions issue is suggested by,
http://trac.edgewall.org/wiki/TracGit#Troubleshooting

"Wrong permissions may also be the cause of the error GitError: GIT control files not found, maybe wrong directory?. Make sure the repository path is accessible via git by the tracd process."

Pascal Dauer

unread,
Aug 22, 2014, 3:45:05 AM8/22/14
to trac-...@googlegroups.com
Yep, my bad.
SELinux blocked the access.
Both of the following commands allows now the access from a http request:
chcon -R -t httpd_user_content_t /usr/share/trac/ 
chcon -R -t httpd_sys_script_rw_t /usr/share/trac/

I read the troubleshooting section, but i thought it was a different error.
Thanks for your help!

Regards,
Pascal

Ryan Ollos

unread,
Aug 22, 2014, 3:48:29 AM8/22/14
to trac-...@googlegroups.com
Thanks for letting us know the solution. I see now that we have an SELinux page (1). Feel free to update it if you have any additional contributions.

Ryan Ollos

unread,
Apr 29, 2015, 12:45:17 AM4/29/15
to Austin Mico, trac-...@googlegroups.com
On Tue, Apr 28, 2015 at 9:43 PM, Austin Mico <un.f....@gmail.com> wrote:
I have the same issue but the selinux is disabled.

 Which Trac version? You may just need to append "/.git" to you path, if Trac < 1.0.2.

Austin Mico

unread,
Apr 29, 2015, 2:03:22 AM4/29/15
to trac-...@googlegroups.com, ryan.j...@gmail.com
I have the same issue but the selinux is disabled.

Reply all
Reply to author
Forward
0 new messages