Repositroy creation failed. (name already exists on this account) #182731
Replies: 6 comments 1 reply
-
|
So from my understanding, you have a new app on your laptop and want it to connect to your old gitub repo right? If this is correct then follow these steps on your new laptop inside your new project folder: 1. Go into your app folder and open a terminal therecd new-app 2. Clean reinstall only needed packagesrm -rf node_modules package-lock.json 3. Initialize git locallygit init 4. Connect this folder to your existing GitHub repo (ecosensors is you Username for github/ and the URL: https://github.com/ecosensors/new-app.git is supposed to be your existing remote repo URL if not then update with your current remote repo link )git remote add origin https://github.com/ecosensors/new-app.git 5. Get remote history (does NOT overwrite your local files)git fetch origin 6. Switch to main branch and link it to GitHubgit checkout -b main 7. Commit your new local app codegit add . 8. Push code and overwrite remote files (GitHub history, releases, tags stay safe)git push --force origin main |
Beta Was this translation helpful? Give feedback.
-
|
You don’t need to delete your GitHub repository or recreate it. The error happens because GitHub Desktop is trying to create a new remote repo, but one with the same name already exists. What you actually want is to link your fresh local project to the existing remote repository. Create your Expo app again, install only the packages you need, then initialize git locally, make a commit, add the existing GitHub repository as the remote, and force-push. Force-push tells GitHub to make the remote repository match your local version while keeping releases, tags, and repo settings. This replaces the code but keeps the repository itself. GitHub Desktop isn’t ideal for this workflow — using git from the terminal is the correct approach here. |
Beta Was this translation helpful? Give feedback.
-
|
Hi, many thanks for your replies. |
Beta Was this translation helpful? Give feedback.
-
|
Hi! This is a common Git/GitHub workflow question, and the good news is that you don’t need to delete the remote repository or lose history. Key pointYou cannot “recreate” a repository locally and overwrite a remote one without first connecting them. Git needs to know they are the same project. Recommended approach (keep history & releases)Instead of creating a new repository, do this:
This preserves commit history, tags, and releases, while letting you reset the codebase. About GitHub Desktop errorGitHub Desktop fails because:
Instead, use “Add existing repository” and point it to a folder that already has About packages and clean installsTo reinstall only what the app needs:
Important noteThere is no safe Git command that automatically deletes remote files based on local absence. That’s why Git works via commits and pushes—so changes are intentional and traceable. Best practice for the future
Hope this clarifies things. Let me know if you want steps specifically for GitHub Desktop only (no CLI). |
Beta Was this translation helpful? Give feedback.
-
|
You don’t need to delete the remote repository or lose any history. What’s happening is that GitHub Desktop is trying to create a new remote repo, but one with the same name already exists — so GitHub correctly blocks it. What you want instead is to connect your new local project to the existing remote repository, not create a new one. The correct approach is:
This keeps all commits, releases, and history, but updates the repository with your new clean setup. GitHub Desktop can also do this by choosing “Add existing repository” instead of creating a new one, then publishing changes to the already-existing remote. So in short: you can’t “override” a remote repo by creating it again, but you can attach your local project to the existing repo and push over it without losing history. |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
I am facing a challenge. I started a new React Native project with the command
npx create-expo-app@latestand I developed the App.I also add a repository to my account with success. During the process of the development of the App, I need to install some package from /Users/user/Dev/new-app/.git
I changed and get a new laptop and I do not want to clone my repository new-app, which would be easier. I (re)run the command 'px create-expo-app@latest' and I want to reinstall all and only the needed package for the App. (as a clean install)
And I do not want to delete my remote Repository because I would like to keep the history and the Releases.
With Github Desktop, I added a new repositoy. I selected the local "new" folder (new-app) and at the end of the process I got the error message Repositroy creation failed. (name already exists on this account) which make sens because it already exist.
Is there a way "to say" to git :"yes I know, but you can override all with the local version and delete the local files/folder if it does not exist on local"?
I could delete the remove repository and add the local, but I will lost all Realease and history. Not so good ...
Thanks for your help.
Beta Was this translation helpful? Give feedback.
All reactions