2017-12-05 5 views
0

新しいレールアプリを既存のサンプルリポジトリに追加しようとしています。私は前にこれをやった。私はRails 5.1.4とgit 2.11.0を使ってGoogle Cloud Platform Compute Engineインスタンスで現在のDebianを使用しています。新しいレールアプリから指定されたリモートリポジトリがありません

つまり、私は新しいレールアプリを追加できますが、そのアプリケーションのディレクトリの中からを追加/コミット/プッシュしようとすると、エラーが発生します。アプリケーションのトップレベルディレクトリの上から追加/コミット/プッシュすると、すべて動作します。

これを再作成するのは簡単です。私は:

rails new foo 

新しいレールアプリを作成します。私はその後、アプリを追加コミット、およびプッシュ:

次の出力(省略)になり
git add . 
git commit -m "testing" 
git push 

[master 95cb836] testing

76 files changed, 1197 insertions(+)

create mode 100644 railapps/foo/.gitignore

create mode 100644 railapps/foo/Gemfile

...

私は何の問題を持っていないこの時点で。しかし、私はそのアプリに移動して、プルまたはプッシュをしようとするとき、私は次のエラーを取得:

git pull 

fatal: No remote repository specified. Please, specify either a URL or a

remote name from which new revisions should be fetched.

git push 

Either specify the URL from the command-line or configure a remote repository using

git remote add

and then push using the remote name

git push <name> 

OKを、十分に簡単、ちょうど、リモートを指定します?その結果

git remote add origin [email protected]:pathto/myrepo.git 

git push --set-upstream origin master 

error: src refspec master does not match any.

error: failed to push some refs to '[email protected]:pathto/myrepo.git'

答えて

0

あなたはこのケースで--set-upstreamオプションを使用しないでください。 ちょうど使用:

git push origin master 
0

は、だから私はこれが追加されたときにわからないんだけど、今は空のgitリポジトリとして新しいプロジェクトを初期化する(少なくともバージョン5.1.4のような)デフォルトのレールで(Gitの初期化を使用して)。

rails new --help 

への呼び出しが

-G, [--skip-git], [--no-skip-git] # Skip .gitignore file

を示したが、これは誤解を招くです。このオプションでは実際にgit initを呼び出さないので、問題は解決します。だから私が電話すると

rails new whatever -G 

この問題は起こりません。

関連する問題