2

問題は、git リポジトリがあり、それを GitHub にアップロードしたいということです。SOF で複数のスレッドを実行したところ、git push -u origin master が提案されました。問題は、そうすると、データを失わないように最初にマージする必要があることがわかります。そのため、git pull を提案してくれました。私はやった、これは私が得るものです:

You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.

If you often merge with the same branch, you may want to
use something like the following in your configuration file:
    [branch "master"]
    remote = <nickname>
    merge = <remote-ref>

    [remote "<nickname>"]
    url = <url>
    fetch = <refspec>

See git-config(1) for details.

これを修正するにはどうすればよいですか?

編集:これを修正したばかりで構いません。このような問題が発生した場合は、次のようにします: git pull

4

1 に答える 1

7

ブランチがマスターと呼ばれ、リモートがオリジンと呼ばれると仮定します。

git pull origin master

リモコンをまだ設定していない場合、設定するコマンドは次のとおりです。

git remote add origin git@github.com:username/repository.git

どちらの場合も、Originはgithubリモートの一般名です。usernameをユーザー名に置き換え、repositoryをリポジトリ名に置き換えます。その後、githubリポジトリを「origin」として参照できるようになります。

于 2013-02-19T08:44:13.197 に答える