Git command "git svn rebase" not working with XCode 4.3.1 - xcode

I have cloned few SVN Project on my system, I used to do "git svn rebase" to sync them up with SVN Repositories. Now after updating XCode to version 4.3.1, this command stopped working.
Executing "git svn rebase" on my mac (v 10.7.3) gives me error "git: 'svn' is not a git command".
I suspect, Apple is no longer installing git-svn with new XCode. Do anybody has any idea, how to fix this issue?
Thanks.

I'm quite sure git-svn never came included in the command line tools but I might be wrong. Anyhow, that's not the point, use macports (or any alike, it just happens I use this one) to get it installed:
$> sudo port selfupdate
$> sudo port variants git-core
Here you're shown the different variants for a given port (in this case git-core), and amongst them there is the one we need:
...
svn: Bi-directional subversion repository support
...
We install it by typing
$> sudo port install git-core +svn
And off you go, you should be able to use git-svn again!

Related

Mac command line tools 11.4 no longer has svn

I just updated XCode and the command line tools to 11.4. Now when I run svn it says "svn: error: The subversion command line tools are no longer provided by Xcode". The release notes say "Command line tool support for Subversion — including svn, git-svn, and related commands is no longer provided by Xcode. If you need Subversion or related command line tools the you need to install the Command Line Tools package by running xcode-select --install." I seem to be in a loop here, as the tools are installed. Has anyone experienced this problem and resolved it?
macOS Catalina
I had the same issue after upgrading to Catalina 10.15. It's clearly mentioned in the Apple website that SVN is deprecated in Xcode 11:
You can find it here: https://developer.apple.com/documentation/macos_release_notes/macos_catalina_10_15_release_notes
Command line tool support for Subversion — including svn, git-svn, and related commands — is no longer provided by Xcode.
The solution is to install the standalone Command Line Tools package instead:
sudo rm -rf /Library/Developer/CommandLineTools
followed by:
sudo xcode-select --install
This will replace the bundled Command Line Tools with the standalone package.
If it doesn't work for you then try to install it with brew.
brew install svn
brew is a package manager for MacOS so if you don't have it installed then you can simply install it: https://brew.sh/
macOS Big Sur
I faced the same issue Today (16th November 2020) after upgrading to MacOS Big Sur. I was able to fix it by installing the SVN again using brew install svn command.
If you faced permission errors after running above command, you can fix it by running following command.
sudo chown -R $(whoami) /usr/local/*
brew install svn
in Xcode 11.4. Svn has been removed.
I had same issue from Netbeans and have done the following from command line and now all fine
sudo xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install svn
Coming from a FreeBSD background we elected to install SVN via MacPorts which is akin to FreeBSD Ports. So basically one would first need to install MacPorts and then install SVN as follows:
sudo port install subversion
Some details -
Install MacPorts: https://www.macports.org/install.php
Install SVN: https://trac.macports.org/wiki/howto/Subversion
It took less than five(5) minutes and works well for us.
I switched to SVNKIT which works very well for my purposes. Since I'm doing a lot of Java development is no drawback for me that SVNKIT is based on Java.
The big advantage is that SVNKIT will still work even if Apple throws SVN out completely.
I found svn still available on my Mac (upgraded from 10.15.x -> Big Sur, including XCode upgrade) in
/Library/Developer/CommandLineTools/usr/bin/svn
In the Apple Developers forum I read the suggestion to make an alias, which worked for me. However, considering svn is being dropped by Apple, this will probably not work on new installs, but it could be useful for those of us that just want it to work for now after upgrading.
alias svn=/Library/Developer/CommandLineTools/usr/bin/svn
Note: I found it easier to just make a symbolic link to svn:
ln -s /Library/Developer/CommandLineTools/usr/bin/svn /usr/local/bin/svn
my mac os version is macOs Catalina 10.15.5,I try
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
brew install svn
but it not work.so I try to install with source code.It's work!
tar xvf subversion-1.14.0.tar.gz
cd subversion-1.14.0
./configure --with-apr=/usr/local/opt/apr --with-apr-util=/usr/local/opt/apr-util
make
now,you can find it in /usr/local/bin/
Based partly on the other answers here, I built from source with this procedure:
Download & unpack svn source tarball (NOT zip file!) from
https://subversion.apache.org/download.cgi
cd subversion-1.14.0
./get-deps (this seems to have downloaded apr and apr-util but not
built them)
cd apr
sudo mkdir /usr/local/opt
(because I did not already have such a directory on a fresh Mac)
./configure --prefix=/usr/local/opt/apr
make
make test
(saw lots of "OK" and "SUCCESS", plus one failure in "testsock")
sudo make install
cd ../apr-util
./configure --prefix=/usr/local/opt/apr-util --with-apr=/usr/local/opt/apr
cd ..
make
./configure --with-apr=/usr/local/opt/apr --with-apr-util=/usr/local/opt/apr-util --with-lz4=internal --with-utf8proc=internal
make
sudo make install
The top instructions (removing the command line tools, xcode-select --install, and brew install svn) worked for me (Monterey, 12.5.1, on an M1 pro). Thanks!
However, after I did the brew install, I had to manually remove the old svn version from /opt/local/bin before the new version would run. (discovered with $ which svn). Might be the result of migrating from the old laptop to the new one.

How to get GIT running on Mac OS X 10.7.5

I am totally new in this area and tried to download and install Git on my Notebook. As I could not configurate me as a user via the terminal I was doing some research and found out that the latest version of Git might now be ideal for my Mac. So I tried to uninstall Git which I failed to do. I have tried using different commands which I have found in the internet. How can I uninstall or make git usable?!
Information to be found in my Terminal:
macgaia:~ miriam$ which git
/usr/local/git/bin/git
macgaia:~ miriam$ git --version
Segmentation fault: 11
macgaia:~ miriam$

How to update my version of git on OSX 10.8

I'm on OSX 10.8.2 and I'm running git git v1.7.4.4
I just installed git on a remote server and it's version 1.11.x. I'm I would like to be running the same version of the software but I cannot figure out how to update git on my laptop.
I attempted to follow the steps listed here, which instruct to download the git-OSX-installer, run the install (which ran smoothly) and then do:
$ sudo mkdir -p /usr/local/bin
$ sudo ln -s /usr/local/git/bin/git /usr/local/bin/git
But after this I do git --version and it's still 1.7.4.4. Did I just reinstall the same version? Or did I install a newer version somewhere else?
I've been reading similar questions and I think the issue is that OSX ships with an old version of git installed in a different location then where the git-osx-installer or mac ports will put it. But I'm not sure how to correct this. Thanks in advance for your advice.
Update:
which git returns:
/usr/bin/git
echo $PATH returns:
/opt/local/bin:/opt/local/sbin:/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194#global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin
Update2:
ESL ~/Downloads$ export PATH=/usr/local/bin:$PATH
ESL ~/Downloads$ which git
/usr/local/bin/git
ESL ~/Downloads$
ESL ~/Downloads$ git --version
git version 1.8.1.3
It appears I installed the newer git version in local. So should I add the export PATH=/usr/local/bin:$PATH to my .bash_profile? Is it a problem that both versions of git are installed?
I added export PATH=/usr/local/bin:$PATH to the bottom of my ~/.bash_profile and now the new version of git runs.
The best way to update any binary on a Mac OSX machine is to use the package(s) developed specifically for Mac (a .dmg or .pkg download).
In the case of git this is at: http://git-scm.com/download/mac
(clicking on this link should automatically start the download of the latest version of git for Mac).
However, in this case (at least for my 10.8.3 MacBook) this was not quite the whole story: the package installs git in /usr/local/git and then adds that path at the end of $PATH - which defeats the whole purpose IMO.
I have manually modified my .bashrc so as to have something similar to what suggested above:
export PATH=/usr/local/git/bin:$PATH
Once you do that, you should see the correct version of git being picked:
$ git --version
git version 1.8.2.2
Note that this won't work for any app that is launched interactively (eg, via the docking bar) - you'll have to run the additional script provided in the downloaded package; see the README for instructions.
Since /usr/bin shows up before /usr/local/bin in your path, the git executable in /usr/bin will be given precedence.
try this in your shell:
export PATH=/usr/local/bin:$PATH
which git
On a side note, I'd strongly recommend using homebrew for managing installations such as this on macos
I had a similar issue in Cygwin (linux environment compiled for windows). I would do
which git
and it would respond with the correct location of the updated git compiled from source, but wouldn't actually use it until I did
hash -r git
I don't claim to understand what this did or why it had to be done, but after that git --version replied with '1.8.2.rc0.22.gb3600c3' which was clearly no longer the old git shipped with Cygwin. This may not apply to OSX, but give it a shot if which git is locating the updated binary.

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

override git from Xcode with homebrew version

I've installed XCode and therefore git is there as well. Since i want to have a newer version of git I installed using homebrew.
But the homebrew version of git is never called since my PATH looks like this
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
which means the /usr/bin/git is allways called before /usr/local/bin/git.
Is there a way to change that without changing the PATH?
Xcode is actually using the GIT that is stored in /Applications/Xcode.app/Contents/Developer/usr/bin. The same version of GIT gets installed in /usr/bin when you installed the command line tools as part of Xcode installation. So, you won't be able to change what Xcode is using (unless you are willing to muck with the contents of the Xcode package). If, from a terminal application, you want to use the homebrew-installed GIT then you have two options:
Reference GIT with the full path as /usr/local/bin/git ... For this case you can create an alias like alias mgit=/usr/local/bin/git and then use mgit ... from the terminal
Change the path as PATH=/usr/local/bin:$PATH either in your .bashrc or .zshrc if you use zsh file (or each time you start a terminal at the command line).
Since Xcode hard coded its own version of git which is installed on /Applications/Xcode.app/Contents/Developer/usr/bin/git, I managed to use this work around trick:
change into the Xcode directory:
cd /Applications/Xcode.app/Contents/Developer/usr/bin
rename the Xcode's git like this:
sudo mv ./git ./git-xcode-usr-bin
link my own git which is installed through homebrew:
sudo ln -s /usr/local/bin/git ./git
And I did the same thing with /usr/bin/git
This will acctually link /usr/local/Cellar/git/1.8.0/bin/git (because I'm use git 1.8.0 at the present)
Certainly this may cause some other problems, such as when I upgrade the homebrew's verion git in the future, it would not work for me :( and I have to make a new link then.
I do it like this because I want to solve my own problem here 13177203. And after search StackOverFlow for a long time, I finally got this solution.
If you are using fish shell instead of bash, you can point to your preferred git binary by adding the following to ~/.config/fish/config.fish.
function git
/usr/local/bin/git $argv;
end

Resources