Tag: bash

Permission Denied (publickey) – Git Bash on Windows

I’m setting up Git Bash on my Windows 10 PC with the intent of using it with Gitlab. Despite setting everything up correctly, a git clone or git push always results in Permission denied (publickey). Before you say it, I’ve looked extensively at all answers to similar problems, and on top of that, I’m fairly […]

GIT hook -> Python -> Bash: How to read user input?

I’m doing a GIT hook in Python 3.5. The python script calls a Bash script that that reads input from the user using read command. The bash script by itself works, also when calling directly the python script, but when GIT runs the hook written in Python, it doesn’t work as expected because no user […]

Unable to create git alias?

I want to create a Git alias so I can run multiple commands at once. I typed the following into the terminal: git config alias.cleanpull “!git reset –hard HEAD; git clean -f; git pull” I assumed that was the correct syntax but I get the following output immediately after entering the command (i.e. from defining […]

How do I cleanup remote git branches that have already been merged?

I have a few repos that I want to clean up, and they have hundreds of branches that have already been merged to master. This is what I have so far git branch -r –merged | grep -v master | xargs git push origin –delete The issue I haven’t been able to get past is […]

git pre-commit hook, add file into index

I’m trying to write a simple pre-commit hook to check if a file was modified, if so, compress it and add it into the current index, something like this #!/bin/sh # was the file modified? mf=’git status | grep jquery.detectBrowser.js’ # is the non-compressed file in the staging area? if [ $mf != “” ] […]

Using variables assigned with heredoc content in a Bash script via Sed

I’m trying to replace some configuration data in Ansible files with values that I have assigned with heredoc. The heredoc data contains values that are retrieved from Git. The end goal is to retrieve Git config and update some Ansible var files with their values. I don’t know how to resolve the error sed: -e […]

Shell script works fine by itself, but produces unexpected results when run through git filter-branch

Here is the script that I want to run using git filter-branch: #!/bin/bash if test -e src/unlagged.cpp; then more +34 src/unlagged.cpp | cat ~/newlic.cpp.txt – > /tmp/unlagged.cpp cp /tmp/unlagged.cpp src/unlagged.cpp fi if test -e src/unlagged.h; then more +34 src/unlagged.h | cat ~/newlic.h.txt – > /tmp/unlagged.h cp /tmp/unlagged.h src/unlagged.h fi Pretty simple. It takes everything past […]

Concurrent execution of script in different tab windows

I’m trying clone down git repo’s concurrently in different Mac terminal tabs as they take a long time to clone down. I’ve tried a lot of variations of the below but can’t seem to get each separate clone and then following commands in 3 separate terminal tabs, running at the same time, any ideas on […]

What are the dashes in git? Such as: -a -b -p

I know generally what they do, but where do they come from? Do they have a formal name? I’ve seen similar letters followed by dashes often in shell commands as well. I couldn’t turn up an answer after some quick searching, since I can’t search for “-a” “-b” etc since the dash isn’t picked up […]

get name of current branch to use for script

I have a done.sh script that I call whenever I am done working on a branch (after publishing the branch to remote repo, and merging it into dev). Currently it only contains the below: git checkout master && git pull I’d like to also include deletion of the current branch. I know that the shorthand […]

Git Baby is a git and github fan, let's start git clone.