111

Ruby on Rails アプリケーションを使用していて、フォークを同期しようとしています。私もMacを使用していることに言及する価値があります。次のアクションをコミットしました。

$ git remote -v

私のローカルリポジトリのビューを取得します。行こうとしたときにめちゃくちゃになりましたupstream

$ git remote add upstream https://github.com/foo/repo.git

Foo を大文字にするべきだった場合:

$ git remote add upstream https://github.com/Foo/repos.git

upstream問題は、これを変更しようとするたびにfatalエラーが発生するため、どのように削除するかです。

4

4 に答える 4

42

git リモートのマンページは非常に簡単です。

使用する

Older (backwards-compatible) syntax:
$ git remote rm upstream
Newer syntax for newer git versions: (* see below)
$ git remote remove upstream

Then do:    
$ git remote add upstream https://github.com/Foo/repos.git

または単に URL を直接更新します。

$ git remote set-url upstream https://github.com/Foo/repos.git

または、それに慣れている場合は、.git/config を直接更新するだけです。おそらく、何を変更する必要があるかを理解できます (読者の演習として残しておきます)。

...
[remote "upstream"]
    fetch = +refs/heads/*:refs/remotes/upstream/*
    url = https://github.com/foo/repos.git
...

===

* 'git remote rm' と 'git remote remove' について - これは git 1.7.10.3 / 1.7.12 2前後で変更されました- 参照してください

https://code.google.com/p/git-core/source/detail?spec=svne17dba8fe15028425acd6a4ebebf1b8e9377d3c6&r=e17dba8fe15028425acd6a4ebebf1b8e9377d3c6

Log message

remote: prefer subcommand name 'remove' to 'rm'

All remote subcommands are spelled out words except 'rm'. 'rm', being a
popular UNIX command name, may mislead users that there are also 'ls' or
'mv'. Use 'remove' to fit with the rest of subcommands.

'rm' is still supported and used in the test suite. It's just not
widely advertised.
于 2013-11-06T00:02:33.763 に答える