Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Renaming a remote (bare) repository with git

I run a git server which contains only the bare remotes. Say, I have one bare remote called DIG.git which I usually clone with:

git clone 55.66.77.88:git/DIG.git

and I want to rename the bare remote on the server from DIG.git to DIGit so that I can do

git clone 55.66.77.88:git/DIGit

Can I just log into the server and do

mv DIG.git DIGit

or is this considered bad practice? If so what is the right way to rename a bare remote?

like image 882
lord.garbage Avatar asked Apr 08 '15 06:04

lord.garbage


People also ask

How do I rename a remote git repository?

Select the repo you want to rename under Git repositories on the left and select .... Select Rename repository... from the menu. If the Repositories pane is not expanded, select > to expand it and display the list of repositories. Enter a new repo name in the Repository name field in the dialog, then select Rename.

How do I change the name of a repository?

On GitHub.com, navigate to the main page of the repository. Under your repository name, click Settings. Under the Repository Name heading, type the new name of your repository. Click Rename.

Can I rename a local git repository?

Navigate to the settings tab. There, in the repository name section, type the new name you want to put and click Rename.

Which of the following git commands is used to rename the name of the remote to source from Origin?

In order to change the URL of a Git remote, you have to use the “git remote set-url” command and specify the name of the remote as well as the new remote URL to be changed. For example, let's say that you want to change the URL of your Git origin remote.


1 Answers

You can rename the top folder of a git repo (bare or not) anyway you want.

It simply is the naming convention to have a .git extension to that folder when it is a bare repo, but this isn't mandatory.

Once you have renamed the repo on the server, you would have to change its origin url on the local clone that you did before:

cd /path/to/local/clone
git remote set-url origin 55.66.77.88:git/DIGit
like image 107
VonC Avatar answered Sep 22 '22 12:09

VonC