hsym
hsym

Reputation: 5477

How to rename rails app, folder and git remote repo?

I have a rails app called appname and a remote repo at bitbucket with the same name. I would like to rename it to another_name.

So far, I've tried changing the remote repo's name to another_name, tried git push and it fails. I didn't try renaming the rails app & its folder though, being afraid that something might break.

What's the right step to do this?

Upvotes: 0

Views: 884

Answers (2)

hsym
hsym

Reputation: 5477

Thanks to Agis' answer, this is how I did it:

  1. Rename the repo in bitbucket website to another_name.
  2. Run git remote set-url origin [email protected]:myname/another_name.git (I'm using SSH instead of HTTPS)
  3. Rename my rails' app local folder to another_name using Windows explorer.
  4. Open up text editor, use the find all feature to find all the files that contain the old name & replace the old name with the new one.

Upvotes: 0

Agis
Agis

Reputation: 33646

If you rename your remote repository, you also have to update the remote's URL in your local git repo:

git remote set-url origin https://new-url-here

You can rename the local folder freely without any side-effects.

Upvotes: 2

Related Questions