Github not installed in terminal os - macos

I downloaded and installed GitHub (latest version) for OS X, installed command line utility under Github in the application and am coming up with an error trying to create my first readme file in a repo entitled "basic-twitbstrap".
Macbooks-MacBook-Pro-2:basic-twitbstrap macbook$ git init
-bash: git: command not found

If they're not installed in standard location, command-line programs need some environment modifications to be called, which consists in adding their directory to the PATH environment variable.
So in your case you need to add /usr/local/github to your path, see how.

I installed the latest version of Ruby Version Manager, then entered 'git' into the Terminal. It came up with a list of usage and common commands.
Now it runs.
Macbooks-MacBook-Pro-2:~ macbook$ git --version
git version 1.7.4.4

Related

vs code git error: Git: /usr/bin/bash: init: No such file or directory

EDIT: I've rebooted my computer, and the issue is fixed. I have no idea why it fixed it.
In vs code on windows, when I try to Initialize Repository, I get the error
However, it used to worked fine. It changed when I tried to install Ubuntu on Windows following this video. Git is installed, and the path is in the .json file.
I'll recommend you to install git in ubuntu by apt
The git.path you've specified is to bash, not git. There's probably some wrapper that invokes that binary using git, and so when you type git init, you're really invoking bash init, which asks bash to run the script named init. Since it doesn't exist, your command is failing.
You should set git.path to a path to a Git binary, and not a bash binary.

Issues while trying to run git uninstall.sh on Mac OS

I wanted to try to update Git on my Mac OS to the latest version and it says to run the provided uninstall.sh first. I must confess that I ran the pkg before reading the "Read me". Not sure if that screwed it all up ...
Now I am not big with the terminal and found the following command to run a shell script:
$ sh uninstall
but that resulted in:
/usr/sbin/uninstall: /usr/sbin/uninstall: cannot execute binary file
where I got stuck now.
Any idea what I have to do to resolve this error?
You should run the uninstall.sh packaged with your previous distribution of Git, as explained in "Install and Update to latest version Git on Mac OSX 10.10 Yosemite":
Upgrading Git from a previous version to the latest 2.0.1
If you have previously installed Git you can upgrade to the latest version by uninstalling the previous install using the uninstall.sh file with the installation.
Go through the same process of downloading and mounting and the .dmg – then launch the Terminal.
uninstall and uninstall.sh are two different things. The former is a binary that comes with the os, the latter is a shell script that comes with the package.
Try: sh uninstall.sh instead

gitconfig error mac OS X 10.10

I’m trying to setup the global config settings for my git installation and when I run the command
git config —global user.name “myname”
I get the following error msg:
error: could not lock config file /Users/vc/.gitconfig: No such file
or directory
my git version on my mac git version 1.9.3 (Apple Git-50)
How can I fix this error?
I found the solution on the following site:
http://coolestguidesontheplanet.com/install-update-latest-version-git-mac-osx-10-9-mavericks/
Under the article, but before you do that, please delete any gui based git installation and then download the latest version of git and follow the instructions below under the title.
Trumping Xcodes Older Git
If you have Xcode already installed and have installed command line tools then you alreay have Git, probably an older version which is distributed with Xcode this is installed in:
/usr/local/bin
To run the lastest version you need to adjust your shell path:
/usr/local/git/bin/git
You need to add add the above path to the beginning of your shell path to take precedence over the other path, the path will be set in either .bashrc or .bash_profile in your home directory.
So add in
/usr/local/git/bin
to the path similar to the below:
export PATH="/usr/local/git/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:$PATH"
Restart or reload the Terminal and the newer Git version will now be used.

How to install go-sql-driver on Windows

I am trying to install go-sql-driver on Windows Vista but I am having problems with GOPATH.
I installed git as suggested and added GOPATH as a new user environment in Windows with path C:/users/A/desktop/go.
I ran go get github.com/go-sql-driver/mysql in the command line but it gives me this error:
C:\>go get github.com/go-sql-driver/mysql
go: missing Git command. See http://golang.org/s/gogetcmd
package github.com/go-sql-driver/mysql: exec: "git": executable file not found in %PATH%
When I go look at http://golang.org/s/gogetcmd it merely says download git. But it is already downloaded in my machine.
I also went ahead and created a new environement variable for PATH and set its path to the directory where git was installed but that did not help either.
What am I doing wrong?
Download the Windows version of Git from http://git-scm.com/downloads.
Run the downloaded executable file, currently Git-1.8.3-preview20130601.exe, which will start a Git Setup wizard to install Git.
Check Git Setup Options
Run Git from the Windows Command Prompt
Checkout as-is, commit Unix-style line endings
Check the installation by running:
C:\>git --version
git version 1.8.3.msysgit.0
Make sure Git is in the %PATH% environment variable and ensure Git is installed. If you cannot run git --version in the command prompt, then the Git binary directory isn't listed in your %PATH%. Fix this by adding Git to the path, close the command prompt, and run git --version in a new command prompt. If you're still having issues, then you might be having other problems.
Install the GIT BASH desktop app in your Windows PC. The download link is here. Once installed, open the shell and type:
go get -u github.com/go-sql-driver/mysql
This will install driver for Golang's MySQL database package

How to upgrade Git on Windows to the latest version

I just upgraded to Git 1.8.0.1 for Windows, from my previous version 1.7.9.mysysgit.0. I downloaded the new version from the Git site and installed through the normal Git installer EXE.
That said, when I fire up my terminal window, it still is showing that I am running Git version 1.7.9.mysysgit.0. When I type git --version from my prompt, the same thing.
I found this article on a similar issue with Git on Mac OS X, which leads me to believe that it has something to do with a faulty PATH, but I'm still pretty new at all this (five months self-taught), so I'm at a loss in how to translate this to Windows.
This problem arose when I began a new Ruby on Rails project and tried to push it up to Git. I added the remote:
git remote add origin git#github.com:brianscottk/blog.git
then:
git push -u origin master
I received the following error message:
fatal: https://github.com refs not found: did you run git update-server-info on the server?
Googling that error led me to this article, which prompted me to upgrade, and here I am.
Since Git 2.16.1(2) you can use
C:\> git update-git-for-windows
In version between 2.14.2 and 2.16.1, the command was
C:\> git update
(It was later renamed to avoid confusion with updating the local repository, e.g. like svn update does it.)
That command does not exist in Git 2.13 and before.
If this errors with "is not a git command" then either you don't actually have Git for Windows, or your version is very old.
In which case, simply get the latest installer from https://git-scm.com/download (check whether you want 32- or 64-bit) and run it to upgrade.
If you already have the latest version it does nothing, in which case you can manually run the installer to reinstall.
C:\> git update-git-for-windows
Git for Windows 2.17.0.windows.1 (64bit)
Up to date
First, check your Git version by using this command
git version
Then follow the case according to your Git version
Three cases:
If your Git version is 2.14.1 or earlier:
Uninstall Git, download the latest Git, and install it again.
And versions between 2.14.2 and 2.16.1:
Use command git update
If the version is equal to or greater than Git 2.16.1(2):
Use command git update-git-for-windows
Git Bash
Note, if you are instead looking to find out what version of Git Bash you are running, or want to see if you need to update Git Bash, it is part of Git for Windows.
So your Git Bash version is:
git --version
git version 2.23.0.windows.1
Note that it is technically different from Bash. On my same machine when I run:
echo $BASH_VERSION
4.4.23(1)-release
Git for Windows installer
To update to the latest version of Git and Git Bash, you can download and install the latest version of Git for Windows. As per this FAQ, settings/customizations should be preserved if they were installed in the appropriate configuration folders.
Note: Their installer is actually intelligently designed to do the right thing (though it doesn't tell you upfront that it defaults to your prior settings automatically!).
If you are doing an update, then every screen on the installer is pre-marked with the settings from your current (soon to be previous) install.
It is not showing you generic default settings. You do not need to look any of them up, or fear for breaking your carefully honed setup. Just leave everything as is, to retain your previous choices.
In fact, they made it even easier (if only it was clear that they did so).
There is a checkbox at the bottom [] Show only new settings (I don't remember the exact wording). Since nothing on the first screen changes when you mark the box, it is not exactly obvious what it is for. If you mark the box, then all of your current settings will be retained, and it will skip showing those (subsequent) settings screens to you. Only screens with newly introduced settings will be shown.
git update-git-for-windows
Alternatively, as others have noted, you can also update Git Bash and Git (by definition, both are always updated at the same time) from the Git Bash command line, via:
git update-git-for-windows
If you type git update, Git kindly reminds you that the command has been updated to git update-git-for-windows:
Warning! git update has been deprecated;
Please use git update-git-for-windows instead.
Git for Windows 2.26.0.windows.1 (64bit)
Up to date
Just give the following command with your command prompt.
git update-git-for-windows
This will ask you a confirmation as follows. Press Y to proceed.
Once the files are downloaded, continue with the normal installation procedures. You can check the Git version after finishing installation with the following command:
git version
For me, the result was as follows.
Update (26 September 2016): It is no longer needed to uninstall your previous version of Git to upgraded it to the latest; the installer package found at Git Windows download site takes care of all. Just follow the prompts.
For additional information, follow instructions at installing and upgrading Git.
If you just type
git update-git-for-windows
If you are having issues with it, run Bash as administrator or add the 'git.exe' path to the "allowed apps through controlled folder access".
If you have already installed Git, you can update Git with the command
git update-git-for-windows
to know the current version, use:
git --version
You can run these commands in the cmd prompt.
Check version: git --version
If your Git version is 2.27.0.windows.1 or earlier
If the version is equal to or greater than Git 2.27.0.windows.1
Use command git update-git-for-windows
If you want to see a video tutorial click here.
Just run:
git update-git-for-windows
Use git update-git-for-windows as in this session:
PS Z:\MERN-STACK-ECOMMERCE-PROJECT> git --version
git version 2.31.0.windows.1
PS Z:\MERN-STACK-ECOMMERCE-PROJECT> git update-git-for-windows
Git for Windows 2.31.0.windows.1 (64bit)
Update 2.33.1.windows.1 is available
Download and install Git for Windows 2.33.1 [N/y]? y
############################################################################################################ 100.0%-
############################################################################################################ 100.0%
PS Z:\MERN-STACK-ECOMMERCE-PROJECT> git --version
git version 2.33.1.windows.1
PS Z:\MERN-STACK-ECOMMERCE-PROJECT>
Using the command "where git" find out how command prompt picks up the version. Once you have the path, you can go ahead and uninstall / delete previous version completely. Then if you install and make sure the new installed location is in the path, it should just work fine.
Using git-friendly tools like cmder will make your life much easier. You don't really have to use dual boot or cygwin anymore since the support for git in windows is already top-notch now. (Git for windows installs msysgit which includes all necessary unix tools from MinGW. MinGW has been there for a while and is pretty stable. If you want you can install the full version of msysgit rather than Git for Windows. msysgit is available on Git for windows page at the bottom.)
You can use,
git update
Or if you are on a Windows machine, you can run the command below,
git update-git-for-windows
Based on Simon's answer, I first uninstalled the new version of Git. I then re-installed the new version of Git into the same directory as the old version, C:/RailsInstaller/Git, instead of the default directory C:/Git.
Now my Ruby on Rails terminal window shows that I am running the new Git version 1.8.0.
If you look at the most recent update on Git's website in the "git via git" section you will see an option to update your older version.
Here is the command that git has on their site:
git clone https://github.com/git/git
It worked for my version of git which was a 2.13.0.windows.1.
To check out your PATH variable, act as follows:
From the Desktop, right-click My Computer and click Properties.
Click the Advanced System Settings link in the left column.
In the System Properties window click the Environment Variables button.
Once there, scroll to get the Path row. You'll get a long string of paths (e.g., C:\windows\bin;C:\program files\git, etc.).
Find the line or lines where git is referenced. Then, make sure this path point to your Git 1.8.x installation. If not, delete it and add the real path to the newest Git version. At the end, you should only have one path in the string linking to Git.
I don't think your problem is related to Windows' global PATH environment variable, as remote is specific to repositories.
I recommend you to use Git under Cygwin. Git could work under Windows command line, but there may be some weird problems hard to figure out. Under Cygwin it's more nature and has fewer errors.
All you need is to type bash in Window CMD, and then start to use the Unix tools and commands. You can use a shortcut to load bash; it's as easy as use normal Windows CMD.
The same is true for Ruby on Rails and Ruby. I used RailsInstaller before, but I found using Cygwin to install Rails is more stable.
Finally, I'll suggest to install Ubuntu dual boot if you have time (about a month to get familiar with it). Windows is not very friendly to every Unix tools ultimately. You'll find all pain stopped.
On my Windows 10, > git update-git-for-windows refused to work with curl issues. Only the below command worked.
winget install --id Git.Git -e --source winget

Resources