Permission denied accessing the local Git repository '/home/user/foo/.git'

880 views
Skip to first unread message

udam.d...@gmail.com

unread,
Aug 4, 2015, 1:19:05 PM8/4/15
to reviewboard
Hello,

I'm trying to set up reviewboard on Fedora linux. I've already disabled SELinux due to other issues starting up Reviewboard. Running apache with the other recommended settings. Now I have review board setup but cannot get my git repository set up (even after trying for a day).

Here's my issue:
- I could not get the get repository setup with remote pointing to my private github repository.
- Since then I have setup a local git repo using ssh 
- I've put the local git repo in multiple places (/tmp/foo, /home/user/foo etc) yet continue to get the same error in the setup repo screen where it says "permission denied accessing the local git repository"
- In the mirror path, I specify ssh://g...@git.host.lan/github/foo.git
- I've tried giving the apache user ownership of the foo directory and the .git directory and given ugo+rwx on both of those directories.

If I specify only the ssh://g...@git.host.lan/github/foo.git as the path and leave the mirror path empty OR specify the same for the mirror path, I can create the repo but cannot post a review to the repo. It fails with the error:

~/D/P/foo ❯❯❯ rbt post --debug
>>> RBTools 0.7.4
>>> Python 2.6.9 (unknown, Sep  9 2014, 15:05:12)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)]
>>> Running on Darwin-14.4.0-x86_64-i386-64bit
>>> Home = /Users/user
>>> Current directory = /Users/user/Development/Projects/foo
>>> Running: git version
>>> Checking for a Subversion repository...
>>> Running: svn --non-interactive info
>>> Command exited with rc 1: ['svn', '--non-interactive', u'info']
svn: E155007: '/Users/user/Development/Projects/foo' is not a working copy
---
>>> Checking for a Git repository...
>>> Running: git rev-parse --git-dir
>>> Running: git config core.bare
>>> Running: git rev-parse --show-toplevel
>>> Running: git symbolic-ref -q HEAD
>>> Running: git config --get branch.master.merge
>>> Running: git config --get branch.master.remote
>>> Running: git config --get remote.origin.url
>>> repository info: Path: http://git.domain.lan/host/foo.git, Base path: , Supports changesets: False
>>> Making HTTP GET request to http://host.domain.lan/api/
>>> Making HTTP GET request to http://host.domain.lan/api/info/
>>> Running: git rev-parse refs/heads/master
>>> Running: git merge-base 7811f02d7382c80525973c17f3cd810d191b81db origin/master
>>> Running: git rev-parse 715970e7fa070b836cf00c0af254bee94776dc08
>>> Running: git status --porcelain --untracked-files=no
>>> Running: git rev-parse --git-dir
>>> Running: git -c core.quotepath=false -c diff.noprefix=false diff --no-color --full-index --ignore-submodules -M --no-ext-diff 715970e7fa070b836cf00c0af254bee94776dc08..7811f02d7382c80525973c17f3cd810d191b81db
>>> Making HTTP POST request to http://host.domain.lan/api/review-requests/
>>> Got API Error 105 (HTTP code 400): One or more fields had errors
>>> Error data: {u'fields': {u'path': [u"fatal: Not a git repository: 'None'\n"]}, u'stat': u'fail', u'err': {u'msg': u'One or more fields had errors', u'code': 105}}
REVIEWBOARD_URL = "host.domain.lan"
REPOSITORY = "foo.git"
Traceback (most recent call last):
  File "/usr/local/bin/rbt", line 9, in <module>
    load_entry_point('RBTools==0.7.4.dev0', 'console_scripts', 'rbt')()
  File "/Library/Python/2.6/site-packages/rbtools/commands/main.py", line 133, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "/Library/Python/2.6/site-packages/rbtools/commands/__init__.py", line 612, in run_from_argv
    exit_code = self.main(*args) or 0
  File "/Library/Python/2.6/site-packages/rbtools/commands/post.py", line 797, in main
    base_dir=base_dir)
  File "/Library/Python/2.6/site-packages/rbtools/commands/post.py", line 479, in post_request
    raise CommandError(u'\n'.join(error_msg))
rbtools.commands.CommandError: Error uploading diff


One or more fields had errors (HTTP 400, API Error 105)

    path: fatal: Not a git repository: 'None'


Your review request still exists, but the diff is not attached.


- Here I tried to post from my laptop which also has the git repository cloned from git hub.

Any help will be much appreciated!

Christian Hammond

unread,
Aug 4, 2015, 3:41:53 PM8/4/15
to revie...@googlegroups.com
Hi,

Just to check, is this repository local to the Review Board server, or remote?

If local, make sure that your web server's user (usually apache or www-data) has read access to everything under the git repository.

if remote, you're going to need to use a service like gitweb/cgit/gitlab/etc, since Git has no support for fine-grained remote access to files/commits. We have some docs on how to do this: https://www.reviewboard.org/docs/manual/2.0/admin/configuration/repositories/#raw-file-urls

Christian

--
Christian Hammond - chi...@chipx86.com
Review Board - https://www.reviewboard.org

--
Supercharge your Review Board with Power Pack: https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
---
You received this message because you are subscribed to the Google Groups "reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reviewboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

udam.d...@gmail.com

unread,
Aug 4, 2015, 3:56:38 PM8/4/15
to reviewboard, chi...@chipx86.com
Hi Christian,

Thank you for the quick response. I'm using local repo due to not having the gitweb/cgit etc. I locally cloned the git repository under my home directory. The whole repository has read privileges to all users of the system (chmod -R ugo+r foo) already.

However, the error message when I try to save the repository configuration is always "Permission denied accessing the local Git repository '/home/user/foo/.git'"

Are there any log files where I can see specific logs related to the error?

I've also installed the beta 2.5 version and tried with that but get the same error message.

Thanks again!

Christian Hammond

unread,
Aug 4, 2015, 3:59:31 PM8/4/15
to revie...@googlegroups.com
Hi,

There's no additional logs for this, as that's basically all the information we're given. That error is coming straight from Git.

Best way to reproduce for testing is to `sudo -s` to your web server's user, then attempt to do a `git ls-remotes` on that repository. See if you get an error.

This does sound like either a permissions issue or SELinux. However, it could also be that the user can't access some parent directory of the repository.

Christian

-- 
Christian Hammond - chri...@beanbaginc.com

udam.d...@gmail.com

unread,
Aug 4, 2015, 5:49:55 PM8/4/15
to reviewboard, chri...@beanbaginc.com
Ok yes, that was the problem. 

For anyone thats in this bad situation in the future, the way to figure out the issue is as follows:

As Christian mentioned, do: 
sudo -su apache (or user who runs apache)
cd to git repo
git ls-remote

In my case, it was failing to connect via ssh (public key denied)

My solution was to:
create a .ssh directory in the home directory of the user (apache). In my case, this was in /usr/share/httpd
in the .ssh directory, i copied over my ssh keys to connect to the git hub repo
cloned the repo under the /usr/share/httpd directory

This succeeds if/when the ssh keys are properly set up.

Once this succeeds, you can submit the repository form with the path set to the local .ssh path AND the mirror path set to the ssh://.... path of your repo.

the misleading thing here is the directory might be given all the permissions needed but still gives that same error message when the ssh public key auth is failing.

One last question: Do we need to manually keep the git repository up-to-date? e.g. cron tab?

Thanks again for the help!!
Udam
Reply all
Reply to author
Forward
0 new messages