2

現在、vikas@VIKAS-PC /D/code/myrepo (マスター) を指す Windows の git bash

次の git コマンドを実行しました。

$ git config --global user.name "Vikas Sharma" 
$ git config --global user.email "vikas.sharma.in@gmail.com"

git init 
git add . 
git commit -m "initial commit"

$ git status 
On branch master nothing to commit (working directory clean)

これで、「git remote」コマンドは何も返しません。私は元のレポを期待していました。

そのため、以下に示すようにオリジンレポを作成しました。

$ git remote add origin D:/code/myrepo

$ git push origin "some-external-repo"

しかし、エラーを下回っています:

error: src refspec myrepo does not match any.
error: failed to push some refs to 'D:/code/myrepo'
4

2 に答える 2

4

あなたのステップに沿って従う:

git init   # You now have a .git directory
git add .  # You've added the working directory files to the index
git commit -m "initial commit" # You now have one commit.

これらの手順のいずれも、リモートを提供しません。

git remote add origin D:/code/myrepo  # Claims that a remote is located there
git push origin # Tries to push to it.

D:/ code /myrepoに「gitinit」を使用してリポジトリを手動で作成しないと、これは失敗します。Gitは、リモートの場所にリポジトリを作成しません。

于 2012-11-02T05:39:00.017 に答える
0

最後に、私はそれを解決することができます。

以下のコマンドは「origin」という名前のローカルリポジトリを作成すると誤って考えました:

$ git remote add origin D:/code/myrepo

しかし、後で「マスター」がローカルリポジトリの名前であることに気付きました。それらを明示的に作成する必要はありません。

今、以下のコマンドが機能します:

$ git push "some-external-repo" マスター

これについて私を助けてくれてありがとうanonfunc。

于 2012-11-05T15:34:30.613 に答える