With great difficulty due to my limited knowledge of Linux, I set up a GIT server on my Raspberry Pi. It works great except for one thing that's been driving me nuts. I've used every Google fu move I can think of and I've gotten nowhere.
I'm using Git Extensions as the client on 3 Windows machines. One at work (no problems) and 2 at home. The local repository at home is on a shared NAS drive on my LAN. It works fine on my main computer, but when I try to access it on my secondary computer, I get the following error:
warning: '//NAS/REPOSITORY' is owned by: 'S-1-5-...' but the current user is: 'S-1-5-...'
where 'S-1-5-...' is two different really long alphanumeric strings that mean nothing to me. It says warning, but then whenever I try to do anything I immediately I get errors I can't decipher after that like: fatal: this operation must be run in a work tree or fatal: No names found, cannot describe anything.
I'm the only user, using the same windows account, username, email address, etc. configured in Git Extensions. As I understand it on the server end, the only user is git which I use for all machines.
As a workaround, I'm able to clone the repository to a different folder on my secondary computer and I have no problems with GIT, but I have problems with my code because it expects things to be in a certain directory. I can change that based on the user, but as far as my code knows, I am the same user on both machines (because I am!). So that is not a good solution. I want to be able to work in the same folder on my NAS no matter what computer I'm using.
-Is there a way to configure GIT or GIT Extensions (I'm not totally sure who is doing the complaining) to not care about ownership? I've tried cloning as a Public Repository, but I guess that doesn't mean what it seems to mean because I get the same errors. -How do I know and/or configure what user GIT or GIT Extensions thinks I am?
CodePudding user response:
It sounds like the issue is related to file permissions on the shared NAS drive. Since you are using the same Windows user account on both computers, it's likely that the issue is caused by the different SIDs (security identifier) assigned to that user account on the two different computers.
To fix this issue, you can try one of the following options:
Change the owner of the shared NAS drive to the user account you are using on both computers. This will allow both computers to access the repository with the same permissions. You can use the chown command in Linux to change the owner of the shared NAS drive, like this:
chown -R <username> <path-to-shared-drive>
Configure the shared NAS drive to allow access to the repository for all users. This will allow both computers to access the repository without checking for ownership. You can use the chmod command in Linux to change the permissions on the shared NAS drive, like this:
chmod -R 777 <path-to-shared-drive>
Configure Git Extensions to use the correct user account on each computer. By default, Git Extensions uses the current Windows user account to access the repository. However, you can specify a different user account to use by setting the user.name and user.email configuration values in Git Extensions. To do this, go to the "Settings" tab in Git Extensions and enter the correct user name and email address for the user account you want to use.
[user]
name = <username>
email = <email-address>
After changing the configuration values, you will need to close and re-open Git Extensions for the changes to take effect.
Keep in mind that this option will only work if the user account you are using on both computers has the same user name and email address.
I hope one of these options helps to fix the issue you are experiencing. Let me know if you have any questions or if you need further assistance.