File permission issues when developing with Windows / hosting with Unix - linux

I am developing a website on my windows laptop, and I use Git for the version control.
When I add my files to Git, they are added under the mode 644. The problem is, on my Linux server, I need the files to be 775. So what I do is, every time I deploy, I have to run chmod 775 -R . on my linux server and then commit the mode changes.
This is really anoying, time consuming, and result in lot of stranges commits.
My question is, how can I make my IDE (PHPStorm) create the files direcly with mode 775? I know Windows does not use the same file permission system as UNIX, but there must be a way to set the files permissions on windows that translates to 775 in Linux?
I tried to use "chmod" command on windows using Cygwin or similar tools, with no luck, Git always saves the files as 644 when I commit on windows.

See: Updating file permissions only in git
In summary, git update-index --chmod should do what you need.

Related

How can i fix/restore linux permissions without reinstalling / deleting my files?

I was trying to change permissons of a folder, and i typed in:
sudo chmod -R 777 /.
I believe it changed my whole system's permissons.
I can no longer connect using ssh/stfp to it.
How can i restore my system permissions without reinstalling / deleting any of my files?
I am using Ubuntu Server
The computer is 64 bit
The files / servers are working fine (HTTP, Games, ETC)
As per this link https://askubuntu.com/questions/508359/restore-default-system-file-folder-permessions you can restore the default system file/folder permissions in linux
and check with the Ubuntu version too.

How to get Linux VM (on Windows host) to access the git working files on a shared directory

I have a Windows PC and on the same PC I have a Lubuntu VM inside the VMWare player.
I share my Windows folders so I can see them from the Lubunutu VM.
My problem is when I clone a Git repo on Windows (using Tortoise Git) and then try to access it from Lubuntu (using Git from command line) all files appear modified although I have not changed them.
I know that reason for this is that Windows and Linux handle the new lines differently.
My question is how can I configure my Git installations on Windows and on Lubuntu so I do not have this problem?
Update:
As suggested (by Craig Estey) this does not seem to be CRLF problem. I tried cloning a repo in my Linux VM on the shared directory and got following error:
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.`
I have no problem cloning the same repo on the VM's local drive.
Any idea what could be the reason?
Note: The main reason I want to do this is to keep my VM's drive size small and use shared drive as much as possible. My VM's local drive is on SSD drive and shared drive is on much larger HDD.
Suppose you put a repository into a Windows Shared folder.
And mount(Mount shared folder on Ubuntu) that shared folder on Ubuntu, so you can clone that repository. (Talking about you can not clone, it must be another problem. I tested it, good for me.)
When you cd to that repository in that mount, you see all files are modified on Ubuntu, then it should be the EOL problem.
On Windows the autocrlf is true by default(assume you are using Git for Windows).
When you clone a repository on Windows, the files will be checkout with CRLF EOL.
But, On Ubuntu the autocrlf is false by default. Using git in that repository which is mount on Ubuntu, git expects the EOL is LF. But, the EOL is still CRLF. That's why git treats all file as modified on Ubuntu.
To fix this problem, make sure both OS to use the same autocrlf value, or using .gitattributes to control the EOL.
For example, using false value:
On windows,
Delete all files in working tree of that repository.
(Note: if you have local changes, commit them first.)
Run git config core.autocrlf false for that repository only. Or
Right click in that repository, click TortoiseGit -> Setting
In Settings dialog, go Git node, select local and un-check the AutoCrlf
Apply the change
Perform git reset hard to get all files back with correct EOLs.
Open TortoiseGit Log Message dialog
Right click on current branch and perform Reset "<current branch name>" to this
Choose "Hard" option
On Ubuntu, you should not see all files modified.
For using .gitattributes:
* -crlf

ClearCase Linux GUI error comparing/checkin-out/describe/

We have ClearCase Server (version 7.0.1.1-IFIX02) installed on a Linux Server "SRV1" (vobs, views and license). The development environment is on another linux server "SRV2". On this server is also ClearCase installed (7.0.1). We access to the views through the ClearCase GUI installed on the development server.
We can access to the GUI without any problem and do any action with the files and directories on the current path where we've started the GUI. But after moving to other directory in the file browser of the GUI, we cannot do checkouts, comparison, describe, ... A windows appear with the "Transcript":
/bin/sh: ./grpXXXXX: No existe el fichero o el directorio
Where XXXXX is 5 digits number different on each action.
The fact is, when using ClearCase GUI on the ClearCase server "SRV1", we don't have such problem.
The simplest way to debug the situation is to revert back to the command line.
If you have ClearCase 7.x, use cleartool. (ClearCase 8.x, use rcleartool):
cd /path/to/your/view/.../yourFolder
cleartool ls
That should give you the current state of that folder and its elements, as well as the selection rules which apply from the config spec of the view.
Note that the issue can vary depending on the nature of said view (snapshot or dynamic, even with ClearTeam Explorer 8.x, since it does support dynamic views as well, and not just web views)
Thanks for your quickly answer!
I solved it!
One colleague suggest me to see owner and group of /tmp. Someone or somehow (this is another question...) has change the /tmp rights, owner and group. Then the development user couldn't write on /tmp. Apparently ClearCase need to write, temporary, certain files "grpXXXXX" when using GUI. So I change to root-root with drwxrwxrwx rights:
chown root:root /tmp
chmod 777 /tmp
And it works!
Regards,

Git, Windows, Linux & NTFS: "index file open failed"

I created a git repo in Windows 7 on a NTFS partition and when opening it in Linux (Ubuntu 12 x64, dual-boot setup) I get the index file open failed error. How can I figure out what's wrong? The partition is mounted read-write and I've never had any other problems. Does git store data in a different format Windows vs. Linux and I need to do either a clone or some conversion? I'd really like to be able to work on the same repo in both OSs without cloning around...
Clarification: I also get cat: index: Input/output error
when running the command cat index in the .git dir, so it is a NTFS related problem... but I've never had it before untill using git in a cross-systems way and I've run other apps from NTFS parts and copied files around...
The .git/index file is a binary file, which describes the current workdir. Perhaps a git fsck is able to fix it up (move the one you have out of the way to make sure it isn't lost while you fool around, or make any expertiments on a copy of the repository). You might try to clone the repository locally, the clone might get a good copy of the file, which you could then copy over the broken one.
Possibly permission problems? Backup what is relevant, defragment the drive, run hardware checks (it might be a broken/breaking disk!).
Either your Linux NTFS driver is broken, or you have filesystem corruption, or both. Reboot to Windows and run the disk checking utility, then see how things stand when it finishes.

SVN Commit error: Can't open file txn-current-lock Permission denied

I can do checkouts, update and such. But when I try to commit changes, SVN gives me the following error:
Can't open file '/svn/p/pokemonium/code/db/txn-current-lock': Permission denied
I am using Windows 7 x64 SP1 with latest version of TortoiseSVN.
UAC is off, my account has read and write access, etc.
I can commit fine to other svn repositorys.
For me it ended up being a permissions issue on the server. I have my repo on a linux box, and ssh in to use svnadmin. For convenience sake, I had executed my create repository command as root. I was looking to get source I had on my Windows box into the repo, so was using TortoiseSVN to set up trunk/branches/tags. The directory containing the repo on the server was owned by root, and Tortoise was coming in as apache. I chowned the directory on the server to apache:apache, and it all went smoothly.
chown apache:apache -R my_repo_root
This is a server configuration issue. On windows host Visual SVN server runs under NETWORK SERVICE account by default. I solved this problem by granting full access rights to the repository folder to this account. Another option is switching Visual SVN service to the SYSTEM account, but that could pose a potential security risk.
Try this.
Make a back up copy of your working copy (just to be safe).
Make another copy your entire working copy off somewhere else.
Take the copy and delete all of the SVN folders out of it
Delete your working copy and do a fresh checkout
now copy/paste your corrupted working copy over your fresh checkout.
it is critical for this to work that you have completely removed ever _svn or .svn folder from your corrupted working copy before you perform the copy/paste.
This will leave you (hopefully) with a working copy that shows (!) on all the files you had modified since your last commit. And fixes your lock issue.
I had the same problem after I re-installed Windows 7 and just copied the SVN Repository from the old Windows to the new one.
After trying the steps that Mr. Manager proposed, the problem was still not fixed in my case.
After making sure that the permissions was setup correctly for the SVN Repository folder I just deleted the file 'txn-current-lock' in the /db folder of the project. That fixed it for me. From thereon I could commit my project again.
I had faced same issue on Unix box
Restarting the Apache service of the SVN server solved myproblem.
-f httpd.conf -k stop
-f httpd.conf -k start
In my own case, my linux server had been restarted after a power loss. The file system remained mounted as read-only since some journal repairs had been made. Rebooting the machine restored full function.
permissions worked for me too
error
repo/db/txn-current-lock: Permission denied
fix
chown apache:apache -R my_repo_root

Resources