Linux – How to get the url of the current svn repo

command-line-interfacelinuxsvn

I have 2 svn checkouts that someone setup for me. Now I need to check these same files on another computer, but since I didn't check them out initially I don't know the urls to use when running the svn checkout command:

svn co WHAT_GOES_HERE?

Since these 2 checkouts already exist on one of my servers, is there a way to get the url of the repo from which they were initially checked out from?

Best Answer

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}'