Github how to rename repository

Github how to rename repository

How to rename a GitHub repository with Git example

Github how to rename repository. Смотреть фото Github how to rename repository. Смотреть картинку Github how to rename repository. Картинка про Github how to rename repository. Фото Github how to rename repository

Community driven content discussing all aspects of software development from DevOps to design patterns.

It’s not a task you will likely have to do often, but every once in a while the situation arises in which you must rename a Git repository. Here are the required steps to accomplish this task

One concern many users have is that the renaming of a GitHub repository will cause problems with Git clone, push, pull, and fetch operations, as the GitHub URL is changed, and that often leads to a repository not found error.

Github how to rename repository. Смотреть фото Github how to rename repository. Смотреть картинку Github how to rename repository. Картинка про Github how to rename repository. Фото Github how to rename repository

GitHub repository moved message after the repo is renamed.

Fortunately, the GitHub team has you covered in this regard. If any users perform a Git push or pull with the old Git URL, the server will perform a redirect while instructing the developer to update their remote Git references. So even though the Git repository URL changed, when you rename the GitHub repo, it won’t negatively impact users on the DevOps team.

Github how to rename repository. Смотреть фото Github how to rename repository. Смотреть картинку Github how to rename repository. Картинка про Github how to rename repository. Фото Github how to rename repository

The GitHub repo rename operation is relatively straight forward.

Microsoft’s Azure Advisor service offers recommendations based on five categories. Learn these categories and the roles they play.

Researchers with Palo Alto Networks took the stage at Black Hat to explain how configurations and system privileges in Kubernetes.

how to rename a repository on github? [duplicate]

I got some github repos that i now need to rename, but i can’t anywhere find a solution for this except deleting the repo and setting up a new one. I can’t delete the repos, because there are a lot of links pointing to the current repos, which i don’t want to loose. Anyone any idea on how to do this? (I already read a lot of the google results and searched the github support).

Github how to rename repository. Смотреть фото Github how to rename repository. Смотреть картинку Github how to rename repository. Картинка про Github how to rename repository. Фото Github how to rename repository

3 Answers 3

Trending sort

Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.

It falls back to sorting by highest score if no posts are trending.

Switch to Trending sort

I have changed the name of repositories before, and I’m doing it again right now 😉

Edit the name using the built-in feature under the «Settings» tab at the top of your GitHub repository page. Then go to your local repository and rename the remote. Like this:

First remove it:

then add back the new name

If you have recent enough git version you should use set-url command:

Now it should be good to go.

Yes you can, see here:

If I understand you correctly you want to rename your git repository eg xyz.git to xyz1.git and then have all the git repositories that link to that repo link to the new name automatically?

As far as I know this isn’t possible. Each repository is self contained and keeps a list of locations it links to. If one of those locations changes its name the link would be broken. Each repository that references the changed name would need to update its link.

But then, the same would happen if you deleted a repository and recreated it under a new name.

How do I rename a repository on GitHub?

I wanted to rename one of my repositories on GitHub, but I got scared when a big red warning said:

Does anyone have step-by-step instructions on how to accomplish #1 and #2 manually? Or what do I have to do locally?

12 Answers 12

Trending sort

Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.

It falls back to sorting by highest score if no posts are trending.

Switch to Trending sort

If you are the only person working on the project, it’s not a big problem, because you only have to do #2.

Then your project’s URL will be 1

If you rename your project, it will change the someproject part of the URL, e.g.

(see footnote if your URL does not look like this).

So after you rename your project, you will have to tell your working copy the new URL.

You can do that in two steps:

Firstly, cd to your local Git directory, and find out what remote name(s) refer to that URL:

Then, set the new URL

Or in older versions of Git, you might need:

( origin is the most common remote name, but it might be called something else.)

But if there are lots of people who are working on your project, they will all need to do the above steps, and maybe you don’t even know how to contact them all to tell them. That’s what #1 is about.

1 The exact format of your URL depends on which protocol you are using, e.g.

Github how to rename repository. Смотреть фото Github how to rename repository. Смотреть картинку Github how to rename repository. Картинка про Github how to rename repository. Фото Github how to rename repository

Note that since May 2013 («Repository redirects are here!»), you can rename your GitHub repo without breaking any links:

We’re happy to announce that starting today, we’ll automatically redirect all requests for previous repository locations to their new home in these circumstances. There’s nothing special you have to do. Just rename away and we’ll take care of the rest.

As a special bonus, we’ll also be servicing all Git clone, fetch, and push requests from previous repository locations.

That means you don’t even have to git remote set-url (change the url of your remote GitHub repo) on your local cloned repo!
Although Gabriel notes in the comments that the official GitHub help page strongly recommends that you do so:

to reduce confusion, we strongly recommend updating any existing local clones to point to the new repository URL. You can do this by using git remote on the command line:

GitHub Pages sites are not automatically redirected when their repositories are renamed at this time.
Renaming a Pages repository will continue to break any existing links to content hosted on the github.io domain or custom domains.

Plus, the user still owns the namespace: if he/she creates a new repo using the old name of the renamed repo, that redirection (for said renamed repo) will stop working.

Github how to rename repository. Смотреть фото Github how to rename repository. Смотреть картинку Github how to rename repository. Картинка про Github how to rename repository. Фото Github how to rename repository

I rename my own just by simply :

After this step, GitHub will make sure that, your online repository matches your local folder name. At this step your problem is solved, unless you also want to rename your local folder. Then do it manually and just use the Github client for windows to refind again your repository into your hard drive, and Github will match it again. That’s all! Very simple.

The simplest way I found

Go to your repo link for example:- https://github.com/someuser/someRepo.git

Click on setting tab.

Github how to rename repository. Смотреть фото Github how to rename repository. Смотреть картинку Github how to rename repository. Картинка про Github how to rename repository. Фото Github how to rename repository

the first thing you can see is your repo name, you can edit that.

Note:- If you have cloned repo on local so, change its folder name manually, that’s all.

Github how to rename repository. Смотреть фото Github how to rename repository. Смотреть картинку Github how to rename repository. Картинка про Github how to rename repository. Фото Github how to rename repository

I see a lot of positive feedback to responses I don’t find accurate/complete at all.

There are two things to have in mind:

If you haven’t cloned your repo in your machine yet, you just need to rename the Github repository and then proceed to clone the repo so you can have a local copy. In order to rename the Github repo, you just need to:

If you already have a local copy of the project, apart from following the steps above, you need to make sure your local repository (root folder) is renamed properly and it’s pointing to the right remote url 🙂 link. In order to achieve that, do the following:

$ git remote set-url origin https://github.com/userX/repositoryU

$ git remote set-url origin git@github.com:userX/repositoryU.git

Hope it helped. If you have any questions or the post is not clear enough, let me know.

I have a local repository (has a local remote-origin file:// ).
How do I change the displayed name of this repository in the Github desktop app without having to rename the repository directory name.

This is the mess that it causes:

Github how to rename repository. Смотреть фото Github how to rename repository. Смотреть картинку Github how to rename repository. Картинка про Github how to rename repository. Фото Github how to rename repository

Github how to rename repository. Смотреть фото Github how to rename repository. Смотреть картинку Github how to rename repository. Картинка про Github how to rename repository. Фото Github how to rename repository

4 Answers 4

Trending sort

Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.

It falls back to sorting by highest score if no posts are trending.

Switch to Trending sort

How do I change the displayed name of this repository in the GitHub desktop app without having to rename the repository directory name?

Create aliases for repositories locally

Many developers keep more than one copy of a repository in GitHub Desktop, and the way repositories are displayed makes it tricky to differentiate between them.

In GitHub Desktop 2.8, you can create aliases for your local repositories to easily tell them apart in the list.

Github how to rename repository. Смотреть фото Github how to rename repository. Смотреть картинку Github how to rename repository. Картинка про Github how to rename repository. Фото Github how to rename repository

Github how to rename repository. Смотреть фото Github how to rename repository. Смотреть картинку Github how to rename repository. Картинка про Github how to rename repository. Фото Github how to rename repository

Also GitHub desktop has no provision to rename the local repositories.

Workaround:

To override displayed repo names ( to be run in dev-tools: [ View > Toggle developer tools ] ) Best to save it as a snippet ( Sources > Snippets ) [unfortunately this will have to be run on each start]

This is the result:

Github how to rename repository. Смотреть фото Github how to rename repository. Смотреть картинку Github how to rename repository. Картинка про Github how to rename repository. Фото Github how to rename repository

Here is AHK script to automate the execution of the script snippet at launch:

Renaming a branch

In this article

You can change the name of a branch in a repository.

People with write permissions to a repository can rename a branch in the repository unless it is the default branch or a protected branch. People with admin permissions can rename the default branch and protected branches.

About renaming branches

You can rename a branch in a repository on GitHub.com. For more information about branches, see «About branches).»

When you rename a branch on GitHub.com, any URLs that contain the old branch name are automatically redirected to the equivalent URL for the renamed branch. Branch protection policies are also updated, as well as the base branch for open pull requests (including those for forks) and draft releases. After the rename is complete, GitHub provides instructions on the repository’s home page directing contributors to update their local Git environments.

Although file URLs are automatically redirected, raw file URLs are not redirected. Also, GitHub does not perform any redirects if users perform a git pull for the previous branch name.

GitHub Actions workflows do not follow renames, so if your repository publishes an action, anyone using that action with @ will break. You should consider adding a new branch with the original content plus an additional commit reporting that the branch name is deprecated and suggesting that users migrate to the new branch name.

Renaming a branch

Updating a local clone after a branch name changes

After you rename a branch in a repository on GitHub, any collaborator with a local clone of the repository will need to update the clone.

From the local clone of the repository on a computer, run the following commands to update the name of the default branch.

Optionally, run the following command to remove tracking references to the old branch name.

Help us make these docs great!

All GitHub docs are open source. See something that’s wrong or unclear? Submit a pull request.

Источники информации:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *