Friday, July 24, 2020

Sunday, July 19, 2020

Thursday, July 16, 2020

Add git information to your bash prompt

To show git information in your bash prompt, add the following function in your ~/.bashrc

function git-shell() {
  export GIT_PS1_SHOWDIRTYSTATE=1
  export PS1='\[\033[01;33m\] (git) \[\033[01;34m\]\w$(__git_ps1 " \[\033[01;32m\](%s)")\[\033[00m\]\n\$ '
}

Then, in your bash, run "git-shell" and you will get a nice git prompt:

 (git) /path_to_your_git_project (master *)
$ 

Tuesday, July 14, 2020

curl returns "ssl_choose_client_version:unsupported protocol" error in Ubuntu 20.x

If you encountered "ssl_choose_client_version:unsupported protocol" when using curl in Ubuntu 20:

    $ curl https://somehost/
 
curl: (35) error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol


It may because the "somehost" only accepts old protocol (e.g. TLS v1, etc.), but in Ubuntu 20.x, the OpenSSL assumes minimum = TLS v1.2 by default. 

If the "somehost" just cannot upgrade to TLS v1.2, you might consider fixing it with the following:

1) Modify /etc/ssl/openssl.cnf

Search for the line "oid_section = new_oids"

Add the following lines below it:

openssl_conf = default_conf

[default_conf]
ssl_conf = ssl_sect

[ssl_sect]
system_default = system_default_sect

[system_default_sect]
MinProtocol = TLSv1.1
CipherString = DEFAULT@SECLEVEL=1

2) curl "somehost" with the following parameters

$ curl --tlsv1 https://somehost

3) If the "somehost" just using a self-signed certificate

    $ curl -k --tlsv1 https://somehost

Reference:



Sync multiple git repo at once

Use the following command in Linux will do the job:  ls -d RepoNames* | xargs -I{} git -C {} pull