Why my Git Bash is crashing when opening it and not starting? - bash

Directory C:\Windows\system32\drivers\etc does not exist; exiting
If directory name is garbage you need to update your msys package

Reinstall Git Bash and update MSYS package.
Also check your system path to make sure MSYS package is set correctly in your system environment variables.
Control Panel > System and Security > System > Advanced system settings > Advanced tab > Environment Variables
Check etc directory if missing. Usually recreated in Git Bash installation directory C:\Program Files\Git\etc

Related

When GitBash is started, how to detect & catch the event, when .gitconfig file is loaded and git global credentials are set

I need to run a pre-defined function(containing git commands) just after GitBash is started and .gitconfig file is loaded and it's global config values are set, so that during execution of this pre-defined custom function, the Git Authentication errors are not encountered.
How can I achieve that ? Not very familiar with Bash events and loading sequence..
Git for Windows version 2.20.1 - Windows 7 x64.
To the best of my knowledge, .gitconfig is not loaded when bash starts (it's loaded every time a git process starts, for sure, but not bash). If you want to define custom commands and stuff to be available on bash, the best place to do it is to use ~/.bash_profile to define them. Git for Windows: .bashrc or equivalent configuration files for Git Bash shell

Adding Git to PATH Variable - Can't find GitHub under AppData/Local

I was following this guide here on how to add Git to my Path variable so I can use it from the command line (Not just Git Bash).
Installing Git in PATH with GitHub client for Windows
To quote an answer, Git was supposedly located here
Get the Git URL
We need to get the url of the Git \cmd directory your computer. Git is
located here:
C:\Users\\AppData\Local\GitHub\PortableGit_\bin\git.exe
I opened File Explorer and went to the directory C:\Users\AppData\Local\
Under the view tab, I have Hidden Items checked. I cannot see a GitHub folder listed. In the search bar, I appended GitHub to the end of the directory path and got the following message
Windows can't find 'C:\Users\username\AppData\Local\GitHub'. Check the spelling and try again.
I'm trying to add Git to my environment path variable, but can't find where git is located.
In Git Bash, I was able to try which git where I got /bin/git
But I'm not sure how I can find what to put in under environment variable.
Doing a random search, I actually found that the Git folder was located here
C:\ProgramFiles(x86)\Git
But what am I supposed to enter for the path variable? This is different from the answer in the other question.
Just add the path to the command. This was the path to add to the end of the windows PATH.
C:\Program Files\Git\bin\
Now we should be able to find git.exe by typing
git
It turns out Git was being sneaky!
It was supposed to be installed in AppData/Local, but was actually installed in the Program Files(x86) directory.
I added this to my Path variable after a semicolon
C:\Windows\Program Files(x86)\Git\bin\git.exe
And magically, I can run git again.
For Windows 7 using GIT 2.7.2 I used this in the path under environment variables:
;C:\Program Files\Git\bin;C:\Program Files\Git\bin\cmd. I then typed git --version from a command prompt and got:
git version 2.7.2.windows.1
Another way is found in this place https://stackoverflow.com/a/34767523/5842689
the best thing is you can test if work in cmd.
"o verify, restart cmd and type git --version in cmd"
it works for me cause the real path in my case (Win10 x64)is
C:\Program Files (x86)\Git\bin\git.exe

Cygwin not executing .bashrc after Heroku Toolbelt Windows install

After installing Heroku Toolbelt, Cygwin is no longer executing .bashrc How do I fix this?
This heroku/toolbelt issue on github Creates/overwrites ENV['HOME'] on Windows, which breaks Cygwin says to
Renaming HOME to %USERPROFILE% evidently fixes this
My HOME System Properties Variable is already named %USERPROFILE%.
Being a noobie I focused on a PATH issue. I began changing my System Path Variable to include the .bashrc PATH
C:\cygwin\home\usermatt
I then tried various system PATH variables, one at a time, restarting my machine each time:
C:\cygdrive\c\home\usermatt\
C:\home\usermatt\
C:\cygwin\c\home\usermatt\
Cygwin's pwd on startup is /cygdrive/c/Users/usermatt. I tried moving .bashrc here without success.
The Cygwin FAQs and the comments in the file itself warn of problems after editing the etc/profile file and I did not try this.
All was well before installing Heroku Toolbelt. How can I get Cygwin to find the .bashrc file?
According to the link you provided:
you need to remove the HOME environment variable from the system
properties. Look how to set/remove variables from Windows permanently.
This will depend on your Windows OS, but in general:
Right click on your "Computer" and select Properties
Click on "Advanced System Settings"
Click on "Environment Variables..."
Find and delete the Home variable
OK your way out and try Cygwin again

why is vc-git and magit in emacs ignoring my git config settings?

I'm running the official windows binary of emacs 24.1.1 with magit. When I commit a file, the username and email shown on the log are ripped from my account and machine name, rather than using the values set in either the global git config or the local settings for this repro.
From git bash and dos, I can ask git for user.email and user.name and get the local repro settings.
magit and vc-git's diff mode also seems to be ignoring my autocrlf settings, so this may be an emacs-wide problem, not specific to magit.
C:\Program Files (x86)\Git\cmd is is on emac's exec-path.
How can I either instruct magit to find the correct settings, or tell it manually what the settings are?
You might want to control that your $HOME is the same from Emacs point of view, and from your shell point of view. Chances are that they're not the same, hence $HOME/.gitconfig is not found in Emacs.
you can add a HOME enviroment varibales and specify the dir the same with the .gitconfig dir.

MacPorts Installation -- Shell Commands/Postflight Script

I had run the MacPorts installer (2.0.3) for my OS X Leopard (10.5.8) which finished "successfully". Unfortunately the port command was not available so I looked in the MacPorts Guide which says that the installer should have run a so-called "postflight" script that sets the necessary environment variables. I tried to run the postflight script manually (which I downloaded from here), but the execution fails with the following output:
Detected the bash shell.
Your shell already has the right PATH environment variable for use with
MacPorts!
Your shell already has the right MANPATH environment variable for use with
MacPorts!
Your shell already has the right DISPLAY environment variable for use with
MacPorts!
Adding [default] tag to sources.conf if needed...
couldn't read file "/Contents/Resources/upgrade_sources_conf_default.tcl": no
such file or directory
Updating port image format...
couldn't read file "/Contents/Resources/images_to_archives.tcl": no such file or
directory
Synchronizing the MacPorts installation with the project's rsync server...
-bash: __PREFIX__/bin/port: No such file or directory
An attempt to synchronize your recent MacPorts installation with the project's
rsync server failed!
Please run 'sudo port -d selfupdate' manually to find out the cause of the
error.
You have succesfully installed the MacPorts system, launch a terminal and try it
out!
Read the port(1) manual page and http://guide.macports.org for help,
http://www.macports.org/contact.php if you need to get in touch with The
MacPorts Project.
Any ideas?
First invoke the port command directly:
$ /opt/local/bin/port help
If that comes back with something reasonable (like the help text) then it's just that your $PATH isn't being used by your current shell. Try logging off and back on again to resolve that in the short term (this will test that your .bashrc file is correctly configured) or you could just modify the PATH environment variable directly (which doesn't test .bashrc):
$ export PATH=$PATH:/opt/local/bin
You downloaded the postflight script but it alone cannot access the accessory scripts in Contents/ because those are located into the install package.
Those missing Tcl scripts are for upgrading from an older install, the log says PATH was already correctly configured but the macports bin directory could have the wrong position in PATH variables, for instance being at the end of PATH.
If you are doing a fresh install you can just only need PATH and MANPATH -you want man pages provided by macports before system's ones- as per [1]
[1] http://guide.macports.org/#installing.shell.postflight

Resources