How to get the url of the current svn repo?

Solution 1:

You can get the URL of the directory you are in, as well as the Repository Root and other info by running the following command in any of the checked out directories:

svn info

If you want a command that returns only the URL of the repository, perhaps for use in a script, then you can pass the following parameter:

svn info --show-item repos-root-url 

It is worth noting that --show-item is available in Subversion 1.9+. In older versions you can use the following snippet the achieve similar result:

svn info | grep 'Repository Root' | awk '{print $NF}'

Solution 2:

For SVN 1.7 I had to use

svn info | grep '^URL' | awk '{print $NF}'

I hope this helps anyone else that comes here with a newer SVN


Solution 3:

No need to grep, just use AWK for the search and delimiting the string
svn info | awk '/^URL/{print $2}'