Git not working. Installed XCode - xcode

Using an iMac running OSX 10.8.5 (Mountain Lion). It's a work computer and can't upgrade to a higher OS version at the moment for various reasons.
I tried installing XCode so that I can use Git but it isn't working.
In terminal I run:
git --version
and get this response:
-bash: git: command not found
What am I doing wrong?

You need to install git separately:
http://burnedpixel.com/blog/setting-up-git-and-github-on-your-mac/

Source control was only introduced into Xcode 4. This however does not mean git is installed onto your system as part of downloading Xcode. It just means that you can use some git features in a Xcode project by pressing the source control button at the top. To install the actual git go here.

I'm don't know why it appears to be so, but it looks like Git still isn't installed on your computer. Another way to check if Git is installed is by using the which git command. If that still doesn't help, install it separately. Download Git for Mac.

Related

Install Git on Mac without Xcode

I've been using windows for software development. I'm not aware of MacOS internals.
I'm aware that Xcode software is used to develop iOS/Mac apps but I don't need it.
For my usecase, I was able to install intellij, Java, Docker, Minikube & Visual-Studio-Code on my Intel Mac with BigSur...
I'm able to run simple micro-service with working DB in local in docker container.
But when I try to use Git I'm getting this issue:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
I think this is related to Xcode. I didn't want to touch it,
so I tried to install Git by brew.
brew install git but got error
Error: git 2.29.2 is already installed
So I tried to do update
brew upgrade git but again got the below error again.
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
I also tried to remove Git to do a clean install
brew remove git and there was no error, but then I installed git with brew again and the same error.
Is there a way to install Git without having Xcode ?
I dont want to install unnecessary software on my machine, things which I don't need.
Note that this is a plain copy of a previous answer of mine on superuser.com.
Here's a way to install git on Mac OS X without XCode.
Git's official web site provides an installer : http://git-scm.com/download/mac
After installing git, you also have to add its directory to your path :
echo "PATH=/usr/local/git/bin:\$PATH" >> ~/.bash_profile
source ~/.bash_profile
Adding the directory to the path will prevent Mac OS X from aksing you to install XCode each time you type git in the terminal.
Credits goes to Bobby Allen and to GoZoner's answer on SO.
What you need is not xcode but xcode command line tool which has a small download and running file space compared to xcode of 11GB download space and running space of 31GB
You can download it from apple at https://developer.apple.com/downloads/

How do I properly upgrade SVN on MAC?

I'm starting on a new team who are all on PCs using TortoiseSVN with SVN version 1.9.2. I'm on a Mac OSX (El Capitan) using the Versionsapp. When I check svn --version in terminal i get 1.7.10.
When I try any svn command such as svn update I get
svn: E155021: This client is too old to work with the working copy at
'/Users/dpowell/Desktop/sites/site.org.new' (format 31).
You need to get a newer Subversion client. For more details, see
http://subversion.apache.org/faq.html#working-copy-format-change
I've gone to the site and downloaded the python script but don't know it will do anything to help (i.e. I don't know how to use it). I've also downloaded the 1.9 package and tried installing svn that way.
I'm not sure what path to take to solve this issue
The Python script you downloaded from there was to downgrade your SVN version - you need to upgrade your SVN version. I recommend going the homebrew route - it will save you lots of pain in upgrading / installing OSX packages in the future.
Follow the instructions here: http://brew.sh/
(copy that line into a terminal an press ENTER, then follow the prompts)
Then, when homebrew is installed, so update SVN, just do brew install svn.
In Terminal, type "svn --version" to find out what version you currently have
Go to http://www.wandisco.com/subversion/download#osx and download the latest client for OS X and install it. This will install the new svn into /opt/subversion/bin
Got to your terminal and check your $PATH by typing "echo $PATH". If you don't see /opt/subversion/bin in there, make sure you add it by typing export PATH=/opt/subversion/bin:$PATH. If it DOES exist and appears AFTER /usr/bin, then you may need to remove an older copy of svn that came installed on OS X. To do so, go to /usr/bin and remove all files starting with svn. This isn't an exact science but it should do the trick.
For me export PATH=/opt/subversion/bin:$PATH worked as it was installed in /opt/subversion/bin
Make sure you reload your .profile first by typing
. ./.profile*
Type "svn --version". You should see that you have the newest version installed!
brew upgrade subversion
Others solutions require you to register an Account?? forget them.

GitHub for Mac no longer installs Git message

I have been using the Github for Mac app and it works great.
This morning while launching the Github app I get the following message:
GitHub for Mac no longer installs Git
OS X 10.9 and later includes Git, so GitHub for Mac will no longer
install Git as part of its command line tools.
The version of Git you have installed through GitHub for Mac is no
longer supported. It's recommended that you uninstall it as soon as
possible.
[ Uninstall Git Later] [ Uninstall Git Now ]
Should I uninstall Git? Will I lose my git configs ?
Yes, you can uninstall Git (the one oncluded by GitHub for Mac)
You won't loose any configuration, unless you have been fiddling with git config --system.
Only the "system" config would have been modifying the installation folder of that embedded Git.

Reasons why git is not visible to Rstudio (OSX)

I have been trying for a few hours to use git within Rstudio on my macbook. However, the option to use git within version control is missing - the only option remains (none).
I have installed github, and then git directly, using the link given
in the rstudio website.
I have attempted to run the bash script
supplied with the git installation file.
I have verified that git is
active on the machine through both github and directly through the
command line.
I have located the git file in the hidden folder
/local/git/bin/git
and pointed Rstudio to this using global options.
I have reinstalled git a couple of times.
I have logged off and on again multiple times.
Any solutions very welcome.
Thanks,
Jon
The same just happened on my mac. I narrowed down the issue to the Xcode developers package update. The fix in my case was:
From a shell go to /usr/bin
sudo ./git
Agree to the terms
Close and reopen RStudio
VoilĂ . Git has returned to RStudio.
My RStudio git tab disappeared after upgrading to OS X El Capitan. I tried following the advice in the top answer:
but I got the error:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
which led me to discover I had to reinstall XCode command-line tools. I did this via:
xcode-select --install
I also updated to latest release of RStudio. Then my git tab reappeared.
I just came across your question after I encountered a similar issue on windows. You've probably sorted yourself by now but just to let you & others know what worked for me.
From RStudio Tools, Global Options.
Option for Git Executable.
Browsed to git.exe in the git/bin folder.
Now working like a dream.
Andy
It's now working. As expected it took re-installing the operating system, as well as the following:
http://blog.rstudio.org/2013/10/22/rstudio-and-os-x-10-9-mavericks/
Using the preview version available from the link below solved the Rstudio/Git issue instantly.
Same issue with OSX High Sierra
This answer in this thread on GitHub helped me
In short, OSX seems to use another directory for the git file

Xcode and Git installation on MacOSX Mountain Lion

I just installed Mountain Lion and Xcode, so under /Applications/Xcode.app/Contents/Developer/usr/bin I found the Git directory
But when I use Git commands in the shell terminal it returns error of command not found. Any suggestions? I have many Git repos on my mac, so I would like to reuse them without checking them out again :/
You need to install the command line tools (see Xcode -> Preferences -> Downloads) or you can download it from the Apple Developer Download site.
First of all, installing the Xcode Command Line tools is probably not what you want. See this post for more information:
http://www.cocoanetics.com/2012/07/you-dont-need-the-xcode-command-line-tools/
You want to set up symbolic links or aliases that point to the versions of git (and svn etc.) that exist inside Xcode.app. This will cause you to automatically get newer versions when Xcode updates through the app store. Installing the command line tools will only confuse matters because you will end up with multiple versions of git lying around, and you will have to manually update the command line tools.
The commands you will need are:
sudo xcode-select --switch /Applications/Xcode.app # tells 'xcrun' where to look
And then in your shell profile, for example .bash_profile:
alias git='xcrun git' # use 'xcrun' to locate the git binary
Now running 'git' from the terminal will use the latest version inside Xcode.app.

Resources