User Tools

Site Tools


git_bash_notes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
git_bash_notes [2021/08/11 22:10] – created rajugit_bash_notes [2022/08/11 20:06] (current) – [ask for git credentials again] raju
Line 1: Line 1:
 +===== Install additional software in git bash =====
 +==== Install rsync 3.1.3-1 into a non standard directory ====
 +This installs rsync 3.1.3-1 into /opt/software/rsync .
 +
 +Download the software
 +<code>
 +mkdir -p ~/x/software
 +cd ~/x/software
 +curl https://mirrors.huaweicloud.com/repository/msys2/msys/x86_64/rsync-3.1.3-1-x86_64.pkg.tar.xz --output rsync-3.1.3-1-x86_64.pkg.tar.xz
 +</code>
 +
 +Install the software
 +<code>
 +mkdir -p /opt/software/rsync
 +tar xJvf rsync-3.1.3-1-x86_64.pkg.tar.xz -C /opt/software/rsync
 +</code>
 +
 +Update the PATH
 +
 +Add the following lines to ~/.bashrc
 +<code>
 +# For rsync
 +export PATH=/opt/software/rsync/usr/bin:$PATH
 +</code>
 +
 +Ref:-
 +  * http://repo.msys2.org/msys/x86_64/rsync-3.1.3-1-x86_64.pkg.tar.xz - old link; does not work anymore.
 +===== dummy =====
 +==== how to end stdin ====
 +Use ctrl+z.
 +
 +In general, ctrl+z is used to send EOF in Windows and ctrl+d in Linux.
 +
 +Ref:- https://stackoverflow.com/questions/15673120/how-can-i-signal-eof-to-close-stdin-under-the-git-bash-terminal-on-windows-ctrl
 +
 +==== minimum recommended version ====
 +  * github recommends >= 2.29 for caching github credentials (https://docs.github.com/en/get-started/getting-started-with-git/caching-your-github-credentials-in-git). It is the first version offering OAuth support for GitHub.
 +
 +==== links I came across ====
 +  * https://gitforwindows.org/
 +    * Is this same as getting 'git bash' terminal?
 +
 ==== find out whether a terminal is cygwin or git bash ==== ==== find out whether a terminal is cygwin or git bash ====
 <code> <code>
Line 7: Line 49:
 | git bash | MINGW64_NT | | git bash | MINGW64_NT |
 | cygwin | CYGWIN_NT | | cygwin | CYGWIN_NT |
 +
 +Sample shell script snippet:
 +<code>
 +terminal_type=`uname -s | cut -f 1 -d '-'`
 +
 +if [ "$terminal_type" = "CYGWIN_NT" ]; then
 +  echo "Using cygwin terminal"
 +elif [ "$terminal_type" = "MINGW64_NT" ]; then
 +  echo "Using git bash terminal"
 +else
 +  echo "Using unknown terminal"
 +fi
 +</code>
  
 See also: See also:
   * https://github.com/KamarajuKusumanchi/sampleusage/blob/master/bash/compare_strings.sh - shell script snippet to branch off code based on terminal type.   * https://github.com/KamarajuKusumanchi/sampleusage/blob/master/bash/compare_strings.sh - shell script snippet to branch off code based on terminal type.
 +  * https://stackoverflow.com/questions/3466166/how-to-check-if-running-in-cygwin-mac-or-linux
 +
 +==== ask for git credentials again ====
 +<code>
 +git push -v
 +</code>
 +
 +Ref:- https://stackoverflow.com/questions/14643308/how-can-i-force-user-and-password-prompt-when-pushing-to-my-git-repository - suggests to use "git pull -v". But in my case, I was trying to push my code out and wanted git to ask me for new credentials. So I tried 'git push -v' and it worked.
 +
 +tags | update github token in git bash, git config personal token
  
git_bash_notes.1628719819.txt.gz · Last modified: 2021/08/11 22:10 by raju