Permission Denied errors post upgrade to stash 2

I've upgrade 2 instances of stash, one at work and my personal one at home. Oddly the one at home results in this:

leon@bofh-sider:~/git/flux$ git pull origin master 
warning: unable to access '/root/.config/git/config': Permission denied
warning: unable to access '/root/.gitconfig': Permission denied
warning: unable to access '/root/.config/git/config': Permission denied
warning: unable to access '/root/.gitconfig': Permission denied
From ssh://gandalf:7999/SRV/flux
 * branch            master     -> FETCH_HEAD
Already up-to-date.

Which is a little odd. However pull/push/merge/branch etc all still work correctly. Nothing appears in the logs on the stash server.

The permissons on the usual directories are correct:

chown -Rv jira /opt/atlassian/stast/work/
chown -Rv jira /opt/atlassian/stast/logs/
chown -Rv jira /opt/atlassian/stast/temp/
chown jira -Rv /var/atlassian/application-data/stash/

I Have stash/jira on the same box, both running as the jira user. The instance at work is working correctly. Any ideas where I can look next? Does the same for HTTP + SSH.

Both boxes are Ubuntu 12.04 amd64.

Edit: git version 1.8.0

7 answers

1 accepted

Although I'd set the stash user, something weird was going on. Set my init script to su to the jira user first and the error went away.

su jira -c ./start-stash.sh

Weird, but it's just the home setup so I'll just leave it at that!

1 vote

It looks like the problems you're seeing are all on the git client, not on the Stash server. When you do a git pull, git tries to read config settings from a variety of paths and apparently you don't have access to some of the configured paths.

git uses the HOME and XDG_CONFIG_HOME environment settings to lookup the config files. I'd check whether either of these has accidentally been set to /root/.

I was thinking along those lines, but it occurs even as a root user doing a fresh clone:

root@gandalf:~/git# git clone http://lwright@gandalf:7990/scm/SRV/flux.git
Cloning into 'flux'...
Password for 'http://lwright@gandalf:7990': 
remote: warning: unable to access '/root/.config/git/config': Permission denied
remote: warning: unable to access '/root/.gitconfig': Permission denied
remote: warning: unable to access '/root/.config/git/config': Permission denied
remote: warning: unable to access '/root/.gitconfig': Permission denied
remote: warning: unable to access '/root/.config/git/config': Permission denied
remote: warning: unable to access '/root/.gitconfig': Permission denied
remote: warning: unable to access '/root/.config/git/attributes': Permission denied
remote: Counting objects: 3048, done.
remote: Compressing objects: 100% (2418/2418), done.
remote: Total 3048 (delta 1784), reused 809 (delta 450)
Receiving objects: 100% (3048/3048), 284.23 KiB, done.
Resolving deltas: 100% (1784/1784), done.

We saw
remote: warning: unable to access '/root/.config/git/attributes': Permission denied
running Git client version 1.9.4.msysgit.0 from git-scm.comand Stash 3.0.4.

If Stash 3.0.4 tries to switch to the $STASH_USER,
[root init.d]# ./atlstash restart
it starts with "Starting Atlassian Stash as dedicated user atlstash"
git clone displays:
"remote: warning: unable to access '/root/.config/git/attributes': Permission denied"

Switching to the dedicated user first resolves the warning.

[root init.d]# su atlstash
[atlstash /]# cd /etc/init.d
[atlstash init.d]$ ./atlstash restart
starts with "Starting Atlassian Stash as current user"

git clone does not display the remote warning

Hopefully Atlassian will fix how start-stash.sh switches the user. We are running Stash on RHEL.

I faced the same problem today. I set export XDG_CONFIG_HOME=/home/jira and started stash like you as user jira. Worked for me, though I am unsure whether this is a good solution.

BTW, I had this problem without an upgrade. I had moved stash and jira from one server to another.

Same problem here with fresh new installation of Stash. I thnk this should be considered a bug. Thanks a lot for pointing it out though!

@Chris Gruszka that was spot on. Just had to run ./bin/start-stash.sh as the atlstash user. Thanks!

 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

23,094 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you