Category Archives: Misc

Git: Rename “master” to “main”

More and more places are starting to rename their “master” branch to “main”. Here is a short description on one way to do that

1. We start with pulling/commiting all our work so that our Git tree is clean

$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

2. Now we rename our local branch

niklas@HOME MINGW64 /c/git/my-project (master)
$ git branch -m master main

niklas@HOME MINGW64 /c/git/my-project (main)

3. Now we create the “main” branch on our remote

$ git push -u origin main
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote:
remote: To create a merge request for main, visit:
remote:   https://git.mycompany.com/nb1-team/my-project/-/merge_requests/new?merge_request%5Bsource_branch%5D=main
remote:
To https://git.mycompany.com/nb1-team/my-project.git
 * [new branch]      main -> main
branch 'main' set up to track 'origin/main'.

4. and lastly we remove the “master” branch to prevent any misstakes commiting to it in the future

$ git push origin --delete master
To https://git.mycompany.com/nb1-team/my-project.git
 - [deleted]         master

NOTE! If you have pipeline scripts that depended on “master” before you need to update them to use “main” now
NOTE 2! If your project used “master” as “Default branch” you need to change that to “main” now

Tested on Windows 10 and GitBash v3.5.2

How to use SPNEGO negotiation with Curl

1. First we need to check that we have an SPNEGO compatible Curl installed:

$ curl -V
curl 7.81.0 (x86_64-w64-mingw32) libcurl/7.81.0 OpenSSL/1.1.1m (Schannel) zlib/1.2.11 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.1 libssh2/1.10.0 nghttp2/1.46.0
Release-Date: 2022-01-05
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz MultiSSL NTLM SPNEGO SSL SSPI TLS-SRP zstd

Here we can see that the SPNEGO feature is available

2. Next we need to create a credentials cache for Curl to use

kinit <username>
Password for <username>@<domain.com>: <password>

Here we create a “authentication token” and put it in a credentials cache för Curl, and any other program ie. SoapUI and others, to use. ‘username’ is the name of the user. This can be omitted, and if so the default user and domain (user that runs the command) will be used instead. The ‘kinit’ command will ask for the password associated with the user. After this has been inputed the token is created

3. After that we run Curl with the following options:

curl --negotiate -u : https://a-spnego-protected-site/data-i-want-to-access

–negotiate will trigger SPNEGO behaviour
-u is needed but is left blank. On some sites though I have had to put <domain\user> to get it to work
: should point to the SPNEGO protected resource we want to access
Curl will now use the token in the credentials cache to authenticate against the web resource

Troubleshooting commands:

klist - lists all current tokens with the expiry timestamps in the cache
kdestroy - remove a ticket from the credentials cache

Tested with Curl v7.81.0 in GitBash on a Windows 10 with Java 1.8.0_301

My default ports cheat sheet

I usually come in contact with many systems and servers that all have many different ports. Some I remember and some I don’t, so I put them here for easy access 🙂

  • DBs:
    • MySQL: 3306
    • PostgreSQL: 5432
    • MariaDB: 3306
    • Mimer SQL: 1360
    • OracleDB: 1521
    • IBM DB2: 50000
    • Pervasive SQL: 3351 (transactional)/1583 (relational)
    • SQL Server: 1433
  • Java Frameworks
    • Spring framework: 8080
    • Play! framework: 9000
  • Javascript Frameworks:
    • NextJS: 3000
    • Angular: 4200
    • Vue: 8080
  • Mule
    • HTTP Listener Configuration: 8081
  • WebMethods
    • IS: 5555
    • Diagnostics: 9999
    • MWS: 8080
  • ActiveMQ
    • AMQP: 5672
    • OpenWire: 61616
    • MQTT: 1883/8883(SSL)
    • STOMP: 61613
    • Web interface: 8161
    • WebSocket: 61614
  • IBM MQ
    • Queue Manager: 1414
    • AMQP: 5672
    • MQTT: 1883
  • Server:
    • HTTP: 80
    • HTTPS: 443
    • SSH: 22
    • FTP: 21
    • SMTP: 25 (legacy)/587
    • SMTPS: 465
  • Misc web applications
    • Webmin: 10000