Fatal remote origin already exists что делать

Fatal remote origin already exists что делать

Ключевое слово «origin» обычно используется для описания центрального источника (ресурса на сервере) репозитория Git. Если Вы попытаетесь добавить удаленный сервер (remote), так называемый «origin» к репозиторию, в котором описание origin уже существует, то получите ошибку «fatal: remote origin already exists». В этой статье (перевод [1]) мы обсудим подобный случай проблемы «fatal: remote origin already exists» и способ её решения.

Если «origin» URL не соответствует URL Вашего remote-репозитория, к которому Вы хотите обратиться, то можно поменять remote URL. Альтернативно можно удалить remote, и заново установить remote URL с именем «origin».

Пример проблемной ситуации. У нас есть некий репозиторий с именем «git», и мы хотим поменять его текущий origin:

Чтобы сделать это, мы используем команду git remote add command, который добавляет новый remote к репозиторию:

Но эта команда вернула ошибку:

Этим сообщением git говорит нам, что remote origin уже существует.

Способ решения проблемы. Мы не можем добавить новый remote, используя имя, которое уже используется, даже если мы указываем для remote новый URL. В этом случае мы попытались создать новый remote с именем «origin», когда remote с таким именем уже существует. Чтобы исправить эту ошибку, мы должны удалить существующий remote, который называется «origin», и добавить новый, либо должны поменять URL существующего remote.

Чтобы удалить существующий remote и добавить новый, мы можем установить новый URL для нашего remote:

Это предпочтительный метод, потому что мы можем в одной команде поменять URL, связанный с нашим remote. Не понадобится уделить старый origin и создавать новый, потому что существует команда set-url.

Альтернативно мы можем удалить наш remote «origin», и после этого создать новый, с новым URL:

Этот метод использует 2 команды вместо одной.

Источник

Drupal Русскоязычное сообщество

Создал на Гитхабе репу.

Выдает
fatal: remote origin already exists.

Устанавливать Drupal можно так:
1.

Может проблема от того, что раньше пользовался 2-м способом, а теперь попробовал 1-м?

Комментарии

пробовал решить так (не получилось):

Вроде работает Fatal remote origin already exists что делать. Смотреть фото Fatal remote origin already exists что делать. Смотреть картинку Fatal remote origin already exists что делать. Картинка про Fatal remote origin already exists что делать. Фото Fatal remote origin already exists что делать
правда папка files с картинками почему-то пошла в репу

Так зачем ты инициируешь репозиторий (git init), если у тебя уже есть удаленный репозиторий (https://github.com/Vasy0K/portal.git).

Прочитай какой-нибудь букварь по гиту, например вот этот: https://git-scm.com/book/ru/v2

Какие-то продвинутые вещи не нужны, хотя-бы просто понимание базовых команд, ветвей и работы с удаленной репой.

Видимо, как-то слишком по диагонали, раз возникают такие вопросы и удивления. Fatal remote origin already exists что делать. Смотреть фото Fatal remote origin already exists что делать. Смотреть картинку Fatal remote origin already exists что делать. Картинка про Fatal remote origin already exists что делать. Фото Fatal remote origin already exists что делать

Пойми правильно, не стоит задача подколоть. Просто твой вопрос немедленно сигнализирует о том, что ты не понимаешь что за команды ты вводишь, что они делают и как работает распределенный гит. Инвестируй 2-3 часа времени на четкое понимание основ, этим ты застрахуешь себя и своих клиентов от седых волос и сидений в ночи в попытке восстановить похеренный репозитарий.

До того, как разбираться собственно с командами git, и пытаться методом тыка что-то сделать, неплохо бы понимать концептуально, как вообще строится процесс работы. Как вариант, почитать книжку по ссылке @Selpi.

Я понимаю, когда что-то делаю, а не читаю.
Проблема выше решена, но мне хотелось бы услышать технический комментарий, а не посыл.

Дак тебе объяснили уже, что если бы ты понимал, что делаешь, этого вопроса вообще бы не возникло

На развитие drupal.ru

Ваша финансовая помощь дает нам возможность оплачивать хостинг и поддерживать стабильную работу сайта. Благодарим за поддержку!

Трекер

webforms. Странное поведение хука

Entity cache + Redis / Entity cache + Memcache Могут ли работать вместе?

Разные отображения для одной ноды (iframe).

Menu Token Больше не поддерживается на семерке, кто знает аналог?

Количество товара в заказе не больше чем в остатках

Нужен специалист Drupal 9 (разработка сайта)

Как произвести массовое редактирование товара

Как правильно установить библиотеку Blazy используя composer?

Тормозит сайт

Custom breadcrumbs цепочка для материалов терминов таксономии

Новые материалы

webforms. Странное поведение хука

Количество товара в заказе не больше чем в остатках

Нужен специалист Drupal 9 (разработка сайта)

Menu Token Больше не поддерживается на семерке, кто знает аналог?

Как произвести массовое редактирование товара

Внедрение процессинга на Commerce Drupal 7

Народный базар на Друпал

Entity cache + Redis / Entity cache + Memcache Могут ли работать вместе?

Состоялся патч-релиз Drupal 7.83

Как добавить в слайдер ранее созданные мной новости используя модуль Paragraphs?

Содержимое сайта публикуется на условиях CreativeCommons Attribution-ShareAlike 3.0 или более поздней версии. Программные коды в тексте статей — на условиях GNU GPL v2 или более поздней версии.

Источник

GitHub » fatal: удаленное происхождение уже существует»

Я пытаюсь следовать вдоль учебник Майкла Хартла по рельсам но я столкнулся с ошибкой.

Я зарегистрировался на Github и выпустил новый SSH-ключ и создал новый репозиторий. Но когда я ввожу следующую строку в терминал, я получаю следующую ошибку:

просто интересно, кто-нибудь еще сталкивался с этой проблемой?

15 ответов

TL; DR вы должны просто обновить существующий пульт дистанционного управления:

версия:

как указывает сообщение об ошибке, уже есть удаленный настроенный с тем же именем. Таким образом, вы можете добавить новый пульт с другим именем или обновить существующий, если он вам не нужен:

чтобы добавить новый пульт дистанционного управления, например github вместо origin (который, очевидно, уже существует в системе), выполнить следующий:

для тех из вас, кто сталкивается с очень распространенной ошибкой » fatal: remote origin уже существует.», или при попытке удалить origin и вы получаете » ошибка: не удалось удалить раздел конфигурации remote.origin», что вам нужно сделать, это установить origin вручную.

Git окна для Windows PowerShell (и приложение GitHub для Windows) имеет проблему с этим.

я столкнулся с этим, как я часто делаю, снова при настройке моего осьминога. Итак, вот как я заставил его работать.

во-первых, проверьте свои пульты:

сначала вы заметите, что у моего источника нет url. Любая попытка удалить его, переименовать и т. д. все терпит неудачу.

Итак, измените url вручную:

это исправило десятки репозиториев git, с которыми у меня были проблемы, GitHub, BitBucket GitLab и т. д.

вы можете увидеть, какие удаленные репозитории вы настроены для подключения через

это вернет список в этом формате:

это может помочь вам понять, на что указывало первоначальное «происхождение».

если вы хотите сохранить удаленное соединение, которое вы видите с-v, но все же хотите следовать учебнику Rails без необходимости запоминать «github» (или какое-либо другое имя) для РЕПО вашего учебника, вы можете переименовать свой другое репозиторий с помощью команды:

вы должны быть в состоянии возобновить учебник.

сначала сделайте a:

и вуаля! Работал на меня!

в особом случае, что вы создаете новый репозиторий начиная со старого репозитория, который вы использовали в качестве шаблона (не делайте этого, если это не ваш случай). Полностью удалите файлы git старого репозитория, чтобы вы могли начать новый:

а затем перезапустите новый репозиторий git, как обычно:

Если вам нужно проверить, какие удаленные репозитории вы подключили к локальным репозиториям, theres cmd:

теперь, если вы хотите удалить удаленное РЕПО (скажем, origin), то вы можете сделать следующее:

на origin это псевдоним указывая на этот URL. Поэтому вместо того, чтобы писать весь URL каждый раз, когда мы хотим что-то отправить в наш репозиторий, мы просто используем этот псевдоним и запускаем:

говорить git to push наш код от нашего местные мастер филиала до пульт ДУ origin хранилище.

всякий раз, когда мы клонировать репозиторий, git создает псевдоним для нас по умолчанию. Также всякий раз, когда мы создаем новый репозиторий, мы просто создаем его сами.

в любом случае, мы всегда можем изменить это имя на что угодно, запустив это:

так как он хранится на стороне клиента git применение (на нашей машине) изменяя его не будет повлиять на что-либо в нашем процессе разработки, ни в нашем удаленном репозитории. Помните, что это только имя указала на адрес.

единственное, что меняется здесь, переименовывая псевдоним, это то, что мы должны объявить это новое имя каждый раз, когда мы нажимаем что-то в наше хранилище.

очевидно, что одно имя не может указывать на два разных адреса. Вот почему вы получаете это сообщение об ошибке. Уже есть псевдоним с именем origin на локальной машине. Чтобы узнать, сколько псевдонимов у вас и каковы они, вы можете инициировать эту команду:

это покажет вам все псевдонимы у вас плюс соответствующие url.

вы также можете удалить их, если вам нравится запускать это:

Источник

I can not create origin remotely with remote command:

To solve the error, I have tried this:

It is not uploading the files from my local repository to the remote:

Does each repository have its own origin?

Solution: I was using the Powershell that came with Github or Git Shell as it is also called to do my tutorial, once I switched to Git Bash it worked fine.

4 Answers 4

That will replace the current origin with a new one.

Fatal remote origin already exists что делать. Смотреть фото Fatal remote origin already exists что делать. Смотреть картинку Fatal remote origin already exists что делать. Картинка про Fatal remote origin already exists что делать. Фото Fatal remote origin already exists что делать

git remote rm origin

git remote add origin https://yourLink

I had a similar issue but I got it resolved using:

In order to use git push, you must specify final destination follorwed by local_branch ( in my own case, it is master for the local branch and main for the remote branch). They could however be the same. As in:

It’s quite strange as to why your origin doesn’t have a value. Typically, it should look like this:

Your origin doesn’t have the url associate with it. It’s actually name value pair. So when you say «git push origin master», Git substitues the value of origin. In my case, it would be «/mnt/temp.git».

1) Clone the repository in another directory.

4) So come back to your working directory, and run » git remote add origin2 https://github.com/LongKnight/git-basics.git «

5) Run » git remote remove origin «

6) Now run » git remote rename origin2 origin «

8) It should be correctly set now. If so, run » git push «

Источник

What «Remote Origin Already Exists» Error Means and How To Fix It

April 30
Stay connected

Do you write code for a living? Then learn Git, and learn it well. The tool originally created by Linus Torvalds—yes, the creator of the Linux kernel—has become the de facto standard when it comes to source control solutions. To help you along your learning journey, we’ve been covering common Git pitfalls and explaining how to get out of them.

Today, we’ll add another installment to the series by covering an issue you might bump into when following Git tutorials over the web: the «remote origin already exists» error. As far as Git error messages go, this one is pretty straightforward, unlike other weirder messages. It clearly states what the problem is: you’re trying to add a remote called origin, but you already have one with that name. That’s not that different from your operating system preventing you from creating a file with the same name as an already existing file.

In this post, we’ll give more detail into why that error message happens in the first place and then show you a few different ways in which you can address it. Let’s dig in.

«Remote Origin Already Exists» Error: Why Does It Happen?

Picture this: You’re following a Git tutorial you’ve found online. So far everything works fine. Then, you see a line similar to the following one:

After trying to execute the command above, you get the infamous error message:

fatal: remote origin already exists.

Understanding this message is actually easy. Unlike centralized VCSs, Git doesn’t have a central server. In Git, you can have what we call remote repositories, or simply remotes. Remotes represent repositories that you might have read and/or write access to. Those are usually on machines other than your own, and you access them via SSH or HTTP. Keep in mind that, despite the name, remotes aren’t necessarily located on remote machines: despite sounding like an oxymoron, local remotes are totally possible.

Remotes have names to identify them, and you can have as many remotes per repository as you need or want. However, you can’t have two remotes with the same name. So if you try to add a remote with the same name as an already existing remote, boom! Fatal error.

If you want to be really sure the remote called origin actually exists, you can easily check that by running the following command:

That will make your Git list all existing remotes for the current repository. If you want to get more detail, you can add the verbose parameter with the remote command, like this:

That will return not only the names of each remote but also its URLs:

By the way, the message will not always contain the actual word «origin.» Let’s say you’re trying to add a remote called cloudbees but there’s already a remote with that name. In this case, the error message would say:

fatal: remote cloudbees already exists.

Similarly to the way that the default branch in Git is called controller—though that could change in the near future—the default remote is called origin, but you could name it anything you like as long as it’s a legal name in Git.

Solving the «Remote Origin Already Exists» Error in Four Different Ways

Having explained why the error message happens, we’ll now cover some of the several potential solutions you can use to solve the problem. Keep in mind that the solution you’ll use will depend on your specific situation because there are a few different scenarios that can cause this problem to happen.

1. Remove the Existing Remote

The first scenario we’ll cover is the one in which there’s already a remote called origin, but it’s the wrong remote for some reason. Let’s say, for the sake of the example, that you used to use GitLab for storing your repositories online and then decided to switch over to GitHub (or vice versa). To go about that, you could follow the steps below:

Create a new repository online using GitHub or GitLab.

Go to your local repository and remove the existing origin remote.

Add the new online repository as the correct origin remote.

Push your code to the new origin.

If, for some reason, you skip step #2, that will cause Git to display the «remote origin already exists» message. So a possible solution here would be simply removing the existing remote:

git remote remove origin

As explained before, origin is just a name for a remote. It could be a different name for you. To make sure the remote is indeed deleted, you can use the Git remote command you saw earlier. Then, if everything is all right, you can go on to adding the desired remote.

2. Update the Existing Remote’s URL

We’ve just shown you how to remove an existing remote, so you can hopefully add a new one, this time with the correct URL. However, you might be thinking that removing the remote and adding it again with a different link will have an eerily similar result as updating the URL of the existing remote. If that’s the case, you’re right, of course.

So let’s see how to achieve the same result we got in the previous section but in a faster way. You just have to use a single command:

As we’ve said before, we keep talking about origin throughout this post, but there’s nothing preventing you from working with whatever remote names you feel like. So a complete example with origin as the remote name and a URL to a real repo could look like this:

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

3. Rename the Existing Remote

Let’s say that, for whatever reason, you already have a remote called origin. You want to add a new origin, but you also need to keep the old one. How would you go about it?

Easy. Rename the existing remote before adding the new one. Just run the following command and you’re set:

So let’s say you want to rename your origin remote to backup. You’d simply run:

git remote rename origin backup

Then you can add your new remote called origin normally, and you should no longer see the «remote origin already exists» error.

4. Do Nothing!

This is not a joke, I promise you. Here’s the thing: Sometimes, you might get the «remote origin already exists» error when following a tutorial that has some step asking you to add a remote called origin. If you try to run the command and get the error message, it’s possible that you’ve already executed that command and don’t remember.

To check whether that’s really the case, you can use the Git remote command with the verbose option, as we’ve covered before:

That will allow you to see the existing remotes along with the URLs they point to. If the existing remote already has the same URL provided by the tutorial, that means your repo is ready to go and you don’t need to do anything else.

«Remote Origin Already Exists» Scaring You? A Thing of the Past

Git is an essential tool in the modern software developer’s tool belt. Unfortunately, many developers consider Git a hard tool to learn. There’s some truth to those claims. Though the basic Git commands you’ll use most of the time are easy to learn and understand, you might stumble upon a particularly difficult aspect of the tool from time to time. For instance, you might find yourself with a somewhat bizarre error message. Or the various ways in which Git allows you to go back and change things might trip you up a bit.

In today’s post, we’ve covered a fairly common Git error message. Hopefully, you’re now ready to address this error when it comes your way.

If there’s one takeaway you get from this post, we hope it’s this: Even though Git can sometimes feel daunting, it’s actually not that hard once you get used to some of its UI quirks and get somewhat familiar with its fundamentals. So keep studying and keep practicing, and then using Git will feel like second nature in no time.

Источник

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

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