Nano

Nano: Forgot Sudo and Need to Save A File You Don't Have Permissions to Save

You've opened a file from the root system without using sudo and you're editting it without realizing you don't have write permissions. After all your edits, what do you do? Don't lose your file!--you just need to change the save path! You can do that in Nano's save prompt!

So I'm racing to get a LAMP stack up and going on one of my computers. I need to update the php.ini file which resides in the root file-system at /etc/php/7.4/cli/php.ini. In my haste, I opened up the document from within its file path using $ nano php.ini and started any number of edits. I hit ctl-o to save, and Nano gives me an unsurprising line about how I don't have permissions to save the file. Ever seen something like this?

Git Error: Unable to create index.lock

Here's an error I recently came accross in Git when trying to push a commit. If Git is giving you something about being unable to create the index.lock file, it's likely you have a git process running in the background that needs to be resolved before git can move forward.

I was doing some routine updates to Drupal modules today when I got a rather peculiar error: git was unable to create a file called 'index.lock'. I don't know what a lock file is, or why Git even needs to create one, so it caught me by surprise. Reviewing my own terminal, though, and after consulting a thread over at Stack Overflow, It's all clear to me how I ended up where I did. In the end, I fell into the ever enduring trap of not listening to my terminal.