bookmark_borderGit: Message ‘src refspec master does not match any’ when pushing commits in Git

On a recent project, I created a new Git repo and wanted to push my content to the repo from the staging server. You can find a very simple guide on how to do that here.

But as I was trying to push my content to the “existing” repo I was getting this error:

# git push -u origin master
error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/user/newrepo.git'

I was confused, but then remember seeing this error earlier in the process:

# git commit -m "first commit with content"
On branch master

Initial commit

Untracked files:
        assets/
        index.html

Turns out, the sequencing provided in the instructions was missing a critical step – Add the files you want to push to the repo after you set the origin.

So a simple fix was to add, then commit the files:

root@test:/var/www/test.net# git add .
root@test:/var/www/test.net# git commit -m "first commit"
[master (root-commit) 9dcbcbd] first commit
 135 files changed, 69694 insertions(+)

That should do the trick, and get you the response you’re expecting:

# git push origin master
Username for 'https://github.com':

So if you’re stuck with something similar, try checking that you actually added the files to be committed. 🙂

bookmark_borderSQL: Delete all Rows with “foo” in the String

Let’s say you’re building something cool and you try to share this amazing thing with a friend. Then that friend decides to blow your DB up with useless entries. Because that is what friends do.

In such a scenario, you might end up with something like this:

select count(*) from table;
+----------+
| count(*) |
+----------+
|    12687 |
+----------+

If this is you, you might find yourself a bit distraught. But that’s ok, life is not that bad. Hopefully your friend did something like this:

|   12674 | foofoo12664      | foofoo12664@gmail.com        | foofoo12664     | $2y$10$102qeaPYWOzdIrXX2xNTIeOfEjHDKPW9xSRpByRTXas1MgkF7SOby | NULL    |
|   12675 | foofoo12665      | foofoo12665@gmail.com        | foofoo12665     | $2y$10$rcwXM0qSM20OrY8RQIQtU.ztcy5B2kVlT1C09R1ugJudxDBWw.7BK | NULL    |
|   12676 | foofoo12666      | foofoo12666@gmail.com        | foofoo12666     | $2y$10$kCzO15VoVs.l5F2112WY8eAyByLz9Bm1AC/bklQRE3pddWEEjWqHm | NULL    |
|   12677 | foofoo12667      | foofoo12667@gmail.com        | foofoo12667     | $2y$10$lVZVuNIhAwVPTmuJpyyUoO1..HQJhcFmqiGYVBdMCYlLIip4m8xr. | NULL    |
|   12678 | foofoo12668      | foofoo12668@gmail.com        | foofoo12668     | $2y$10$X8RplBFJpeShCg0qnsy64ecloXAtRfotgymi2WR709bTZ6.uN4kem | NULL    |
|   12679 | foofoo12669      | foofoo12669@gmail.com        | foofoo12669     | $2y$10$LVCjD9fqOVXi6A2LVX5FMOSTWnwq5WUK959Kw/M1QeTUsO3qaTBcm | NULL    |
|   12680 | foofoo12670      | foofoo12670@gmail.com        | foofoo12670     | $2y$10$smcLn6eirBkKeZayWVP4mONcoRfEWJOwYRbK08LndCO4F2hJ2Xj.G | NULL    |
|   12681 | foofoo12671      | foofoo12671@gmail.com        | foofoo12671     | $2y$10$mY11LeuTrz4sPLRov2nJceY974TDUIzqzO5spzTkKUDJowMpyszkW | NULL    |
|   12682 | foofoo12672      | foofoo12672@gmail.com        | foofoo12672     | $2y$10$fZJEkthgTXsWHRVYBsQMHuqJFn6FFIHg1vqibm8hqVH4f0yAbuHk2 | NULL    |
|   12683 | foofoo12673      | foofoo12673@gmail.com        | foofoo12673     | $2y$10$1/swwPhmHy66Oole.6Fepeh4hxJDwlOroMlDtCkgggxnsQsjAC86. | NULL    |
|   12684 | foofoo12674      | foofoo12674@gmail.com        | foofoo12674     | $2y$10$Whrwt8j19R4jFC6KdjGLoupsG78mH2fTzXIR78.lfQ/6xtZ/mNc3u | NULL    |
|   12685 | foofoo12675      | foofoo12675@gmail.com        | foofoo12675     | $2y$10$U0o9q3xWAOD2q/L2MBWn/OH4M5mJPODuk07fnfGIbTeKgaLDbBnka | NULL 

In this scenario you can see common each row has similarities (i.e., “foofoo”). Because of this you can open your terminal and use the “Delete” command like this:

DELETE FROM table WHERE usersUid LIKE 'foofoo%';

This will remove each record in the table. This is what you need to know of the command above:

tablethe table storing the data;
usersUidthe column you are going to query;
%his operator is the wildcard, in my scenario I wanted it to delete every row that started with “foofoo” because that was the syntax they used. If I used the % operator before the query words, it would look for that syntax anywhere in the string.

You can then buy your friend a bag of coal for the holidays.


Cheers.

bookmark_borderCreating a Keystore for Android Apps on Windows

If you’re building Android apps for the Android or Amazon Playstore you will need to sign your apps with a certificate. To do this, you will need a Keystore file. There are a lot of instructions on how to do this on a Mac, but if you’re on a Windows machine it’s a labyrinth of useless information.

This is a simple guide on how to create a keystore using Windows, here is what you will need:

Operating SystemWindows 10
JavaJava SDK 17 (or latest version)

Yes, you need Java so just do it.

By default, the installation will go to: C:\Program Files\Java\ (remember this)

NOTE: Open Command prompt as Administrator, not doing this will generate a permission error.

In your command prompt, navigate to the bin folder. For me, it was:

cd "c:\Program Files\Java\jdk-17\bin"

From here, you can now run the keytool application like this:

keytool -genkey -v -keystore my-release-key.keystore -alias [change this value] -keyalg RSA -keysize 2048 -validity 10000 

Set the -alias to whatever you’re going to call it. For instance it could “tonys-androidapp“.

NOTE: You can set the path where you want to store the .keystore by doing something like this

-keystore “C:\Users\Tony Perez\[Path to Keystore]\my-release-key.keystore”

It will prompt you to provide your keystore password:

Enter keystore password:
Re-enter new password:

Save this, you will need it. Fill out the rest of the information as you see fit:

What is your first and last name? Tony Perez
What is the name of your organizational unit? Engineering
What is the name of your organization? Tony Codes, LLC
What is the name of your City or Locality? Texas
What is the name of your State or Province? Texas
What is the two-letter country code for this unit? US
Is CN=Tony Perez, OU=CleanBrowsing, O=CleanBrowsing, L=Texas, ST=Texas, C=US correct? yes

That’s it, now you have a new keystore that you can use to sign your apps.

Cheers!

bookmark_borderNET::ERR_CERT_COMMON_NAME_INVALID When Moving SSL Certs Between Servers

Been doing a lot of spring cleaning lately and every now and then I stumble into walls that send me down rabbit holes. Sucks for me, but it’s great for you. I use this site to document the process for myself, and in the process share some tips for anyone that might need it.

Continue reading “NET::ERR_CERT_COMMON_NAME_INVALID When Moving SSL Certs Between Servers”

bookmark_borderHow to capture POST Requests on Webserver / Website

Sometimes you just want to see what someone is sending to your website. But how? Access logs by themselves can be pretty vanilla, you can see that a user made a POST request, but what exactly did they send?

Caution: This could include sensitive information like log in credentials, credit card information, and other sensitive data. Oh yeah, it will create massive log files that could create Disk I/O issues as well. Recommend doing this in a testing, troubleshooting, capacity only.

You can see what’s in the POST request by using the dumpio module for Apache

Continue reading “How to capture POST Requests on Webserver / Website”

bookmark_borderERROR 1064 (42000) at line 1 – Passing MySQL Create User Arguments via SSH

I was recently building a script to help move things from one server to another and in the process stumbled into a very annoying problem when passing MySQL arguments to a remote server via SSH.

Desired outcome: Create a new user in a remote DB using SSH.

In practice, this should be extremely simple. If you do this on the server, you could execute a command like this:

mysql --user="root" --password="[pass]" --execute="create user 'testing'@'localhost' identified by '123';"

You would now have a new user in your database called testing and it’s password would be 123.

Continue reading “ERROR 1064 (42000) at line 1 – Passing MySQL Create User Arguments via SSH”

bookmark_borderCan’t Scroll in Windows Subsystem for Linux

I don’t know when it started, but at some point in 2021 I was not able to scroll inside my linux terminal on Windows. I really don’t care why it started, but I do know the fix.

After banging my head on a wall, and living with it for a few months, I decided enough was enough.

Continue reading “Can’t Scroll in Windows Subsystem for Linux”

bookmark_borderTroubleshooting PHP-FPM: ERROR: [pool [name1]] unable to set listen address as it’s already used in another pool ‘[name2]’

This error is telling you that you forgot to update your listening address. You likely have another pool configuration pointing to the same address.

For example, name1.conf is pointing to:

listen = 127.0.0.1:9000

Continue reading “Troubleshooting PHP-FPM: ERROR: [pool [name1]] unable to set listen address as it’s already used in another pool ‘[name2]’”

bookmark_borderSigning an App using a CodeSign certificate with SignTool & Windows 10

I was recently working with a new Windows app we built at CleanBrowsing and our users were getting hit with security warnings post-installation. This warning was generated because the app was not signed.

Ok, let’s get things signed.

To sign I would need a code-sign certificate. I went through the process of getting an Extended Validation (EV) certificate from GlobalSign.

Site Note: The process was not too bad, you sign some forms, take some pictures and you’re done. You do need a Windows machine when download the certificate, be prepared for that.

Continue reading “Signing an App using a CodeSign certificate with SignTool & Windows 10”