WDI-SEA / project-4-issues

Open an issue to receive help on project 4 issues
0 stars 0 forks source link

Renaming remote repo #30

Closed Mackmiller closed 2 years ago

Mackmiller commented 2 years ago

What stack are you using?

(ex: MERN(mongoose + react), DR(django + react), PEN, etc.)

DR

What's the problem you're trying to solve?

Renaming my repo to reflect the project topic

Post any code you think might be relevant (one fenced block per file)

Is this stackoverflow answer (see below) what you would recommend for this? I would rather double check beforehand now than mess things up later in git!

There are various possible interpretations of what is meant by renaming a Git repository: the displayed name, the repository directory, or the remote repository name. Each requires different steps to rename.

Displayed Name Rename the displayed name (for example, shown by gitweb):

Edit .git/description to contain the repository's name. Save the file. Repository Directory Git does not reference the name of the directory containing the repository, as used by git clone master child, so we can simply rename it:

Open a command prompt (or file manager window). Change to the directory that contains the repository directory (i.e., do not go into the repository directory itself). Rename the directory (for example, using mv from the command line or the F2 hotkey from a GUI). Remote Repository Rename a remote repository as follows:

Go to the remote host (for example, https://github.com/User/project). Follow the host's instructions to rename the project (will differ from host to host, but usually Settings is a good starting point). Go to your local repository directory (i.e., open a command prompt and change to the repository's directory). Determine the new URL (for example, git@github.com:User/project-new.git) Set the new URL using Git:

git remote set-url origin git@github.com:User/project-new.git

tkolsrud commented 2 years ago

If you want it to have a different name on github, there should just be like a standard edit name field in the settings. This stack overflow solution would be more for like if you wanted to move it to an entire new repo*

Mackmiller commented 2 years ago

But if I just change the repo name remotely, won't my remote source in my git be outdated when I try to push local changes up?

tkolsrud commented 2 years ago

ah i see, yeah then you should be able to just reset the remote

Mackmiller commented 2 years ago

okay cool. I'll close this issue now, and plan on trying it out this afternoon. Thanks!