how to rename a repository on github? [duplicate] - github

This question already has answers 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:
First remove it:
git remote rm origin
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?

Related

How to create a new file in github and add there existing files?

I have files in repository. I want them to be grouped inside a folder. How can I do this?
It seems that I need to add new file if I want to create a folder.
From how you worded your question, it seems like you're trying to work on github directly from the website.
The usual way github works is:
if you have a repo on github and you want to modify it, first 'clone' the repo into your local computer,
use these instructions https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository
then just change folder structure like you would normally on File Explorer (windows) or Finder (mac),
then follow the commit instructions and 'push' up your changes to github
use these instructions
check status of your recent changes:
git status
add the files that you want to include in the commit
git add nameOfFile
check status and the file you want to include should now be green
git status
use this to send to github
git push
Overall github docs here:
https://learn.microsoft.com/en-us/training/modules/introduction-to-github/

How do I get a cloned project into my own github repository?

Normally I get the project easily to github, but now that the project base has been cloned so I can't push it to my own repo for some security reasons.
I cloned project base using the terminal command
git clone https://github.com/username/project.git
Can anyone help with this? or link to a page where a solution can be found?
If I understand your question, I think you are looking to fork? If so, you will want to fork the original repo, and then clone your fork of it.
If that isn't what you are looking for, my next guess is you want to make the original project a dependency in your personal project. In which case, the solution will depend on your specific tech stack.

Safe way to rename GitHub repository to the name of one I just deleted?

I had 2 repos on Github: "RepoName" and "RepoName_old". I thought I was going to rebuild my project but changed my mind and have been improving "RepoName_old" ever since. I deleted "RepoName".
If I rename "RepoName_old" to "RepoName" (the deleted repository), will something go horribly wrong? The official documentation warns against trying to pull from a branch associated with the old name...I guess that's a different thing...will GitHub Desktop acknowledge the new name after I make the change?
I have terrible experience mismanaging my git repositories and I want to avoid another setback by being informed and careful.
GitHub Desktop is a local tool which should reflect the changes done on GitHub.
On GitHub side, if you have deleted RemoName, you should be able to rename "RepoName_old" to RepoName.
Check first that it works on github.com.
Then try and clone it in command line, and, with GitHub Desktop, add it from your local folder. That should force GitHub Desktop to recognize RepoName with its new origin URL.

How do you completely remove a file on github

I've seen the command needed to remove a file and erase it from the history on git. Is there a way to do this with the github website? If not, it looks like I need to know where the file is to do it with a git command. Where does github store the local repositories?
See: https://help.github.com/articles/remove-sensitive-data
To get a local version of the repository, look up the URL from the repo page on Github and clone as explained in the link above.

Change the branch name on github that references HEAD

In my remote bare repository the HEAD is pointing to "refs/heads/master" and I want it to point to "refs/heads/other".
I am not able to go to remote repository directory and run git symbolic-ref. Is there any git command to achieve it? Or any other way?
If there is no way, does Github allow one to change the HEAD?
To change it in github, go to the admin section.
You can select the default branch from a dropdown there.
(There has been posted another question asking basically the same: How do I change a Git remote HEAD to point to something besides “master”, and there was more discussion there, with a reference to the Github group. So I'd just like to point anyone to that discussion as well.)
As we know, there is no universal answer.
But there are a specific answers for various git "farms" (where multiple users can manage git repos through a restricted interface: via http and ssh): http://Github.com, http://Gitorious.org, http://repo.or.cz, Girar (http://git.altlinux.org).
These specific answers might be useful for those reading this page and thinking about these specific services.
Now they have a drop-down menu for selecting the HEAD branch at http://repo.or.cz (example: http://repo.or.cz/editproj.cgi?name=for-me-and-for-all_imz.git);
and at http://gitorious.org, too (look somewhere in the settings);
and at http://GitHub.com: admin > Default Branch > (choose something) (thanks to #srcspider's answer);
and in Girar (running on http://git.altlinux.org to build packages for ALT's distro), one can the ssh interface for this:
$ ssh git.alt help | fgrep branch
default-branch []
$
for example ssh git.alt default-branch packages/autosshd.git sisyphus to change the HEAD in the remote repo autosshd.git to point to the sisyphus branch.