开发者

how to rename a repository on github? [duplicate]

开发者 https://www.devze.com 2023-02-25 18:57 出处:网络
This question already has ans开发者_开发问答wers here: Closed 10 years ago. Possible Duplicate: Change repo name in github
This question already has ans开发者_开发问答wers here: Closed 10 years ago.

Possible Duplicate:

Change repo name in github

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).


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:

  1. First remove it:

    git remote rm origin
    
  2. then add back the new name

    git remote add origin git@github.com:"yourname"/"projectname".git
    

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

    git remote set-url origin git@github.com:"yourname"/"projectname".git

Now it should be good to go.


Yes you can, see here:

Rename github repo

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....

Just realised you were specifically talking about GitHub and not git in general, sorry - should learn to read the entire question like my school teachers said. The answer still stands, with the addition that you can change the name in GitHub from the Admin page.


You also do it via v3 of their API. See here: How do I rename a GitHub repository via their API?

0

精彩评论

暂无评论...
验证码 换一张
取 消