Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update repository location in Git Tower

Tags:

git

git-tower

I have reorganized the folder structure for my repositories in the Mac Finder and now when I open up Git Tower it is informing me that those repositories can't be located. This I understand however I"m trying to figure out how I can update the location of the repository from inside the application. I've looked on the Tower website and researched using Google however I have not come up with any possible solutions.

Does anyone have any suggestions?

like image 458
user3732216 Avatar asked Nov 25 '16 14:11

user3732216


2 Answers

This is quite hacky, but I was able to edit Tower's sqlite file directly and change all broken repo paths at once.

On my system, the file was located here: ~/Library/Application Support/com.fournova.Tower2/Tower.sqlite3. And OF COURSE make a backup before you proceed.

I then used DB Browser for SQLite to run the following SQL queries (all at once):

UPDATE ZGTGITREPOSITORY SET ZFILEURLSTRING = REPLACE (
ZFILEURLSTRING,
'/OldPath/',
'/NewPath/');

UPDATE ZGTGITREPOSITORY SET ZGITDIRECTORYURLSTRING = REPLACE (
ZGITDIRECTORYURLSTRING,
'/OldPath/',
'/NewPath/');

UPDATE ZGTGITREPOSITORY SET ZWORKINGTREEDIRECTORYURLSTRING = REPLACE (
ZWORKINGTREEDIRECTORYURLSTRING,
'/OldPath/',
'/NewPath/');

A few notes:

  • That's basically doing a "find and replace" so your old path needs to be exactly accurate or else it won't be found.
  • You need to URL encode the path, so /my path with spaces/ becomes /my%20path%20with%20spaces/
  • Did I mention make a backup of the file before you proceed?
like image 177
fumble Avatar answered Nov 20 '22 17:11

fumble


This is a known bug for Tower 2.5 Mac and it's being worked on.

In the meantime, you'll have to add new bookmarks to replace the old ones.

The most straightforward way to add new bookmarks would be to use drag & drop from Finder into Tower's Repository View. Since Tower 2.5 you can do so with multiple repository folders selected in Finder.

Disclaimer: I'm with the support team of Tower

like image 27
Samuel Herzog Avatar answered Nov 20 '22 16:11

Samuel Herzog