Renaming Your Remote Github Repository

Today I was going through and re-organizing my JavaScript30 projects and adding Github Wiki pages to them. I came across one repository which I wanted to rename, because it did not mirror the name in the JavaScript30 repository! In addition, I wanted to rename the local repository to mirror the name of my remote repository.

First I renamed the local repository. I was already in the repository which I wanted to rename, array-cardio. I wanted to rename it to array-cardio-day-1. In CLI (Command Line Interface) I typed

PowerShell

1

mv~/development/array-cardio~/development/array-cardio-day-1

That renamed array-cardio to array-cardio-day-1. However, the mv command can also be used to move files and directories. If I wanted to move my cardio1.js file into my ~/developments folder where I have all my projects, for example, I would type

PowerShell

1

mvcardio1.js~/development/

and cardio1.js which was residing in

PowerShell

1

~/development/array-cardio-day-1

would now be residing in the

PowerShell

1

~/development/

development folder (aka directory) itself. If I wanted to move it back to the array-cardio-day-1 directory and within the scripts directory in array-cardio-day-1, I would type

PowerShell

1

mvcardio1.js array-cardio-day-1/scripts/

from within the ~/development folder. So in other words, I would make sure that I was first within the ~/development folder, and then I would type the command. I don’t have to append ~/development to the beginning of the destination path, because I am already there.

Then I checked to make sure I had done it right and cd(ed) into the project by typing:

PowerShell

1

array-cardio-day-1

while still in the ~/development folder. It took me right to it. This is just one of the features that attracted me to Oh my zsh. I didn’t have to type cd array-cardio-day-1, just array-cardio-day-1.

Another great little thing that I have with my Oh my zsh install, is that I can type development lowercase or Development uppercase. The folder was actually created with an uppercase D, Development. But I can type either development or Development to cd into the folder, or use either in commands. As shown above, I used the lowercase d for speed, ease of convenience. What’s even more interesting is that when I type

PowerShell

1

development

and hit return, this is how the path I receive looks in iTerm2

PowerShell

1

~/development:

When I type

PowerShell

1

Development

and hit return, this is how the path I receive looks in iTerm2

PowerShell

1

~/Development:

As I mentioned earlier, I wanted to rename my remote git repository. After renaming my local git repository, I went to Github to rename my remote repository.

I first went into the Settings tab of the array-cardio (it’s original name) repository, and at the top was the option Repository Name. Underneath that, I just typed in the name I wanted to change the repository to, and then hit the rename button. Now array-cardio-day-1 appeared as the name of the repo. Next I exited settings and clicked on the repository name to access the clone or download button. I copied the new path to the repository using SSH, and did the following in CLI:

PowerShell

1

git remote rmorigin

This removed the old remote origin path (aka the old remote repo path). Then I typed

This added the new remote origin path to the local repo. Remember how you always type in this second line when pushing your local repository to your remote repository on Github for the first time? Well, it’s the same thing here after you have renamed your remote repo. You are adding a new name/path to your local repository. If you want to be really anal about it, the next time you push to the remote repo, you can type

PowerShell

1

git push-uorigin master

for example, instead of

PowerShell

1

git push origin master

to make sure that local and remote repos are keeping track of each other. -u is shorthand for -upstream. git push -u origin master is what you would type when pushing a local repo to Github for the first time.

Maria Campbell

Founder, Inter-Global Media Network, Inc., where I focus on Front End Development. as well as a digital photographer, videographer, blogger, broadcaster, and graphic designer. Genesis Framework user. I got my start 8+ years ago teaching myself HTML/CSS and Wordpress Development because I couldn't find anyone who could create what I wanted. I have been working with open source software ever since. I am an open source software evangelist, and a "Women in Technology" evangelist. A creative professional myself, I find Web Development to be both practical and creative. I love to cook, travel, read mysteries, love everything French, the beach at sunrise, my three cats, and hope to revisit the city of San Francisco one day.

Reader Interactions

Comment Policy: Your words are your own, so be nice and helpful if you can. Please, only use your real name and limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please. Comments are moderated, so spammy or malicious links will be removed.