2017-09-26 6 views
1

失敗:あなたは、リモートのためで入れているURLを変更する必要がgitのハブリポジトリの作成は、私は次のコマンドを試してみましたが、失敗した

> cd SecurityAlert/ 
> sudo apt-get install git 
> git init 
> git add . 
> git config --global user.email "[email protected]" 
> git config --global user.name "user" 
> git commit -m "First commit" 
> git remote add origin https_link_github.com/user/SecurityAlert 
> git push origin master 

To https_link_github.com/user/SecurityAlert
! [rejected] master -> master (non-fast-forward)

error: failed to push some refs to 'https_link_github.com/sandeepmhptr/SecurityAlert' hint: Updates were
rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

git pull 

There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details git pull

If you wish to set tracking information for this branch you can do so with: git branch --set-upstream-to=origin/ master

> git remote add -v 

> git remote -v 

答えて

0

。あなたは大丈夫プッシュすることができるはず、あなたのGithubレポ正しくごセットアップ限り、

> git remote add origin https://github.com/sandeepmhptr/SecurityAlert 

その後 - しかし、問題は、あなたが持っていた:

> git remote add origin https_link_github.com/sandeepmhptr/SecurityAlert 

これは次のようになります。

あなたが使用しましたプッシュとそのエラーメッセージから、既にリモートのリポジトリにコミットされているように見えます(origin)。使用しているコマンドで、GitHubの上で新しいリモートに既存のレポを押すため

、GitHubのレポはそれにREADME.mdまたは.gitignoreファイルを追加することなく、を初期化されている必要があります。これらを追加した場合、最初に押す前にrepoを削除し、ファイルを追加せずにrepoを作成するのが最も簡単です。この場合は、まったく同じ名前でリメイクするか、URLを更新してください。

強制的にプッシュすることもできますが、基本的にはローカルリポジトリの履歴でリモートのリポジトリを上書きします。これがまったく新しいレポで、まだ誰もそれをダウンロードしていない場合、それは別のオプションです。リモートレポを保存しておきたい、すでにいくつかのコミットを持っている場合は、プッシュすることができます前に、


は、あなたは、あなたの地元のレポにそれらを同期する必要があります。違いが何であるか、マージ履歴がどのように出てくるかによって、これは非常に詳細になります。

+0

リモートURLはgitリモート追加元ですhttps://github.com/sandeepmhptr/SecurityAlert、ここではgit remote add origin https_link_github.com/sandeepmhptr/SecurityAlertと書かれていますが、このサイトのいくつかの問題のため許可されていません2つ以上のURL – chinmay

+0

こんにちは、これらすべての手順を試してみましたが、それは成功しました – chinmay

+0

さて、リモコンがすでに初期化されているように見えます。私は答えにいくつかの情報を追加して明確にしました。これが役に立ったり、あなたの質問に答えた場合は、チェックマークを付けていただきありがとうございます。 – LightCC

関連する問題