User Tools

Site Tools


git_bash_notes

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

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

Install the software

mkdir -p /opt/software/rsync
tar xJvf rsync-3.1.3-1-x86_64.pkg.tar.xz -C /opt/software/rsync

Update the PATH

Add the following lines to ~/.bashrc

# For rsync
export PATH=/opt/software/rsync/usr/bin:$PATH

Ref:-

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

find out whether a terminal is cygwin or git bash

uname -s | cut -f 1 -d '-'
terminal output
git bash MINGW64_NT
cygwin CYGWIN_NT

Sample shell script snippet:

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

See also:

ask for git credentials again

git push -v

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

copy the contents of a file to clipboard

 | clip

Sample commands:

git status | clip
cat <file> | clip

The clip command just calls clip.exe from C:\Windows\System32\. Make sure you have clip.exe installed somewhere in your PATH.

Ref: https://stackoverflow.com/questions/18880062/piping-output-from-git-bash-to-clipboard

git_bash_notes.txt · Last modified: 2024/06/10 14:27 by raju