Installation git permission denied

The command:
sudo git clone https://github.com/openhab/openhabian.git /opt/openhabian

results in an error: git: fatal error: `chdir’ failed: permission denied.

I’ve tried several things (like chmod dir and add user to group sudo) but without effect.

The complete respons:

Podium:~# sudo git clone https://github.com/openhab/openhabian.git /opt/openhabian
git: warning: invalid extra options ignored

GNU Interactive Tools 4.3.20 (sparc-unknown-linux-gnu), 23:30:02 Jan 26 2005
GIT is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 2, or (at your option) any later version.
Copyright © 1993-1999 Free Software Foundation, Inc.
Written by Tudor Hulubei and Andrei Pitis, Bucharest, Romania

git: fatal error: `chdir’ failed: permission denied.
Podium:~#

( system: Netgear NAS Duo, Debian installed)

Any advise would be most welcome!

Have you tried this?

cd /opt/openhabian
sudo git clone https://github.com/openhab/openhabian.git 

Thx for your response.
Unfortunnally, it didn’t work out.

Usually, when you cannot change directories even as root it is because you are doing something exotic like using SELinux in enforcing mode, which is highly unlikely, or you have accidentally stripped the execute permissions on the directory.

What do you see when you ls -ld /opt and ls -l /opt? if you don’t see x permissions on the folders you can’t change to that directory even as root.

Hello Rich,
This is what i got:

Podium:/# ls -ld /opt
drwxr-xr-x 5 admin admin 16384 Oct 27 18:08 /opt

Podium:/# ls -l /opt
total 48
drwxrwxrwx 2 root root 16384 Oct 27 18:08 openhabian
drwxr-xr-x 4 admin admin 16384 Sep 19 2014 p2p
drwxr-xr-x 9 admin admin 16384 Jun 30 2011 remote

OK, so the execute permissions are not the problem. The only other thing I can think of is if /opt or /opt/openhabian is a mounted network file share (NFS/CIFS/etc.) and the permissions on the file server is not allowing access to the files. If that isn’t the case I’m stumpped.