Git Bash Terminal closing automatically after installing? - github

Git bash is closing automatically in a fraction of second after installation how to fix this?

check whether you've installed git properly, open your command prompt or git bash then type
git --version
C:\Users\07>git --version
git version 2.16.1.windows.1
if you're able to get git version something like this then git is installed in your system. If you're getting any errors or not able to open the command prompt or git bash just check whether you've added git path to your system if not add path and check it once again. Refer this for the installation process and check with the release notes as well.

Related

how can dotfile executeable issue on codespace?

Good day!
when I enable Automatically install dotfiles in the GitHub codespace setting and follow create codespace, my dotfiles are not found, and the install script is not run!
my dotfile repo
When I see the log, codespace says install.sh script not executable!
how can fix this issue?
you must make this file executable with git...
git rm --cached install.sh
git add install.sh --chmod=+x
and next, commit and push to the repo!

fatal: cannot update the ref 'HEAD': unable to append to '.git/logs/HEAD': Bad file descriptor

I am working on Robot framework Automation project. All of a sudden git commit does not work I get below error on commit command
**fatal: cannot update the ref 'HEAD': unable to append to '.git/logs/HEAD': Bad file descriptor**
I am working on Windows machine. I have done 4 commits till now and code is in Repo. With the latest changes, commit is not happening with above error I have gone through few issues quoted in stack-overflow regarding this but I could get it resolved.
Please help me in overcoming this issue
I use the command git commit -a -m "description" or git commit -m "description"
None of the sudo command work for me it says
> $ sudo chown -R useremail .git/
> bash: sudo: command not found
It can happen when you accidently create a branch with root permission. Its best to check .git locally for ownership permissions i.e. ls -la .git/refs/heads/ should be owned by the user and not root.
Try the same command with:
a regular CMD session (no Git bash or Cygwin)
the latest Git for Windows 2.21
a new clone repo
You should not experience that bug again.

VSCode: use WSL Git instead of Git for Windows

I would like to use WSL (Bash on Windows) Git with VSCode instead of Git for Windows to avoid multiple Git installations.
I created a simple bat script to emulate git.exe comportment by redirecting git commands in WSL. It works nicely in CMD but not with VSCode. Also, WSL is my default terminal in VSCode.
VSCode settings.json:
{
"git.path": "D:\\tools\\git.bat",
"terminal.integrated.shell.windows": "C:\\Windows\\Sysnative\\bash.exe"
}
and git.bat:
#echo off
bash -c 'git %*'
Any idea to make VSCode working with WSL Git ?
Since VS Code 1.34 (April 2019) a remote extension has been introduced to develop into WSL: https://code.visualstudio.com/docs/remote/wsl.
Basically, a server instance of VS Code is started into WSL, allowing you to use all the WSL tools (e.g. git) from your client instance on Windows.
Thank you for pointing that out #Noornashriq Masnon!
I created a small tool to solve this for myself, and hosted it on GitHub.
Basic git functionality seems to work, like viewing changes and committing.
A ready-to-use binary can be downloaded from the Releases page.
One of the problems is that the input paths need to be translated from the Windows representation (C:\Foo\Bar) to the Linux paths in WSL (/mnt/c/Foo/Bar), and back again for paths in the output of git.
For example, the Git plugin in VSCode uses the command
git rev-parse --show-toplevel
to find the root directory of the git repository, but with WSL git this of course returns a Linux path that needs to be translated for VSCode on Windows.
Provide the full path for the bash exec :
git.bat :
#echo off
c:\windows\sysnative\bash.exe -c "git %*"
What you can do is to first try wslpath and if that fails you try a normal git command. It's not ideal but it works.
See: Use WSL git inside VS Code from Windows 10 17046

Sourcetree Can't Open Git Bash

On Windows 8 & trying to use SourceTree as my Git client -- all works but the following:
When I hit the terminal button in Sourctree it says "It has not been possible to start the Git Bash terminal" (yes, I'm using the default SourceTree setting to launch the git bash terminal when this button is clicked).
I am able to bring up said terminal but then I have to cd into the proper directory. Really would like the terminal button to work in SourcTree.
Yeah, for me the solution was to upgrade GIT to newest version. I had 1.9.4 and now I have 2.6.3. It works great. Also I noticed that git has new console right now, I see more colors here :)
Check your git version. If you still have system Git 1.9.5 running, then better upgrade to 2.6.3 now. Check your Git Path too then restart SourceTree. The new git bash terminal looks like this:
This may be useful if Cygwin is installed.
Thanks for suggesting to upgrade Git, but it didn't resolve the issue for me on Windows 7.
To find out Git's location, open a new Git Bash and invoke the which git command:
$ "which git"
/usr/bin/git
Remove git.exe from C:\cygwin\bin.
Restarted SourceTree and it worked.

git push error "fatal: Unable to find remote helper for 'https'"

I've added remote origin like:
git remote add origin https://github.com/username/repo.git
When I push the git repository, I get this error:
git push -u origin master
fatal: Unable to find remote helper for 'https'
I am on git 1.7.1 on Ubuntu 10.04.4 LTS
Any ideas, greatly appreciated
If you compiled git from source, be sure to install this package first:
apt-get install libcurl4-openssl-dev
I just got the problem yesterday and solved it today, so am posting in case this might help a Windows user. For me, the problem occurred after I updated to the latest version of Git (because Visual Studio was recommending I do so-- something about things not matching.)
It turns out that I installed in the default directory Program Files, but my old Git was in Program Files (x86). (Hadn't noticed until tried reinstalling.)
Uninstalling the new version and installing the 64-bit Git for Windows Setup listed under Other Git for Windows downloads (which is not the default) overlaying the version in Program Files (x86) worked. (I tried other combinations of version and folders first.)
I did have to delete the local repository already created and restart with git init, git add ., git commit -m "first commit", git remote add origin theGitUrl (all of which worked before), before doing the git push origin master. The weird thing is that a pop-up window appeared to enter my user name and password. I didn't notice it at first and thought the processing on the git push was hung up. So, heads up about that "Other Git for Windows" version.
I did change my Environmental Variables before the fix; I don't know if that helped. I added these 2 to the PATH:
C:\Program Files (x86)\Git\bin
C:\Program Files (x86)\Git\libexec\git-core
I did this for both User and System variables.
A note on updating the PATH in Windows 10: you have to add one at a time and not include the ;
After much searching, the answer is you need git version 1.7.7
Can't update RVM - "fatal: Unable to find remote helper for 'http'"
I was working in a chroot jail and thought i had copied everything i needed for git to work but i was missing the git-core files themselves so i just had to copy them:
cp -r /usr/lib/git-core /opt/chroot/myjail/usr/lib/
Add this to git config: (Checked in centos 6.7 and working)
#git config --global url.https://.insteadOf git://
#To see the config added
#git config --list
url.https://.insteadof=git://
user.name=username
user.email=youremail
....