Git: jak usunąć zdalne pochodzenie z git repo
Zrobiłem git init
aby zainicjować mój folder jako Git repo, a następnie dodałem zdalne repozytorium używając git remote add origin url
. Teraz chcę usunąć to {[2] } i dodać nowe repozytorium git remote add origin new-url
. Jak mogę to zrobić?
11 answers
Zamiast usuwania i ponownego dodawania, możesz to zrobić:
git remote set-url origin git://new.url.here
Zobacz to pytanie: Jak zmienić URI (URL) dla zdalnego repozytorium Git?
Aby usunąć zdalne użyj tego:
git remote remove origin
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2020-01-28 11:06:53
Jeśli nalegasz na usunięcie:
git remote remove origin
Lub jeśli masz Git w wersji 1.7.10 lub starszej
git remote rm origin
Ale odpowiedź kahowella jest lepsza.Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-05-23 12:03:05
Aby usunąć pilota:
git remote remove origin
Aby dodać pilota:
git remote add origin yourRemoteUrl
I wreszcie
git push -u origin master
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-11-03 16:04:49
Możesz wypróbować to, jeśli chcesz usunąć origin, a następnie dodać go:
git remote remove origin
Wtedy:
git remote add origin http://your_url_here
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-02-16 05:27:00
Nie mam wystarczającej reputacji, aby skomentować odpowiedź użytkownika @ user1615903, więc dodaj to jako odpowiedź: "Git remote remove" nie istnieje, powinno się użyć "rm "zamiast"remove". Więc prawidłowy sposób to:
git remote rm origin
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-01-29 09:01:35
Możesz zmienić nazwę (zmieniając adres URL zdalnego repozytorium) używając :
git remote set-url origin new_URL
New_URL może być jak https://github.com/abcdefgh/abcd.git
Zbyt trwałe usunięcie zdalnego repozytorium użyj:
git remote remove origin
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-11-03 16:06:02
Aby ustawić zdalny adres URL origins-
git remote set-url origin git://new.url.here
Tutaj origin jest Twoją nazwą push url. Możesz mieć wiele źródeł. Jeśli masz wiele origin zastąp origin jako tę nazwę.
Do usuwania pochodzenia
git remote rm origin/originName
or
git remote remove origin/originName
Do dodania nowego pochodzenia
git remote add origin/originName git://new.url.here / RemoteUrl
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2019-05-24 08:38:09
Być może jestem spóźniony możesz użyć {[0] } to wykona zadanie.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2019-11-21 12:55:09
Inna metoda
Anuluj lokalne repozytorium git
rm -rf .git
Następnie; Utwórz ponownie git repostory
git init
Następnie; powtórz zdalne połączenie repo
git remote add origin REPO_URL
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-09-13 11:48:16
Możesz przejść do .Git folder, Edytuj plik konfiguracyjny bez użycia komend.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-11-03 16:06:30
Najpierw zmienimy zdalny URL push
git remote set-url --push origin https://newurl
Drugi zmieni zdalny adres URL
git remote set-url origin https://newurl
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2019-04-02 08:29:11