2015-10-08 3 views
5

を送信するためにgitを使用することができません:/home/Tegra.私はローカルに作成されたディレクトリを持って送る、電子メールを、ソースコードやパッチ

私は、次のファイル内の/ホーム/ Tegraのを作成しました:

hello_world.c hello_world_1.c hello_world_2.c 

各ファイルの増分であります変更されました。今、私が最初にのgit送る-メールを電子メールアドレス[email protected]にを使用して電子メールを送信したい

diff -u hello_world.c hello_world_1.c > hello_world_1.patch 
diff -u hello_world_1.c hello_world_2.c > hello_world_2.patch 
  1. :私はまた、パッチを作成しました。 hello_world.cファイル

  2. が含まれている必要がありそれから私は、添付ファイルとしてhello_world_1.patchファイルと第二電子メールを送信します。

  3. 次に、添付ファイルとしてhello_world_2.patchファイルを3回送信します。

残念ながら、私もステップ1を行うことができないです:

私のgitが適切に587ポートTLS関連のSMTPサーバで構成されています。私はエラーを取得、次の

git send-email --to [email protected] --subject My Hello hello_world.c 

Cannot run git format-patch from outside a repository 

リポジトリは、画像に入って来るん

は、私は、次のコマンドを試してみました。最初に自分のコードのリポジトリを維持する必要がありますか?

編集:ステップ1の場合: "MyRepo" ローカルマシン上でそれをクローン化

  • :Githubの上の空のリポジトリを作成し

    1. :コメントを1として、我々は、リポジトリを必要とするの下に。 (使用してgitのクローン)
    2. は、ディレクトリ/ MyRepo」に最初のファイル "hello_world.c" を追加しました。その後
    3. >> gitの追加次にhello_world.c
    4. >> gitの-m「マイ・ファースト・ソースをコミットその後「
    5. 次に>> Gitのプッシュ-u原点マスター
    6. 、私は、型付き:gitの送信、電子メールを[email protected] --subject = "[asdasdas] asdasd ASSD" hello_world.cを

    エラー:

    No subject line in hello_world.c ? at /usr/lib/git-core/git-send-email line 584 
    
  • +1

    はい。 send-emailはリポジトリ内の変更からパッチを作成して送信します。 gitで管理するファイルやディレクトリを指す必要があります。 –

    +0

    こんにちは@AndreasWederbrand、私はGithubで空のリポジトリを作成しました: "MyRepo"、それをローカルマシンにクローンし、最初のファイルを "/ MyRepo"というディレクトリに追加しました。その後、私は入力しました: git send-email [email protected] --subject = "[asdasdas] assd asdasd" hello_world.c エラーが表示されました:hello_world.cに件名がありません。/usr/lib/git-core/git-send-email行584. – Haswell

    答えて

    1

    Then added the first file "hello_world.c" into the Directory /MyRepo".

    まず、あなたが実際にあなたのクローン化された空のレポで何を犯したことを確認してください。

    git add . 
    git commit -m "new commit" 
    git push 
    

    第二に、git send-email doc言及ん:

    --subject=<string> 
    

    Specify the initial subject of the email thread. Only necessary if --compose is also set.

    --composeを使用してください。

    This format expects the first line of the file to contain the " Cc: " value and the " Subject: " of the message as the second line.

    これは、ソース自体ではなく.patchで動作します。
    は、より完全な例については、 "How to send patches with git-send-email" git format-patch、およびを参照してください。最後の場合

    コミット:

    git send-email -1 [email protected] --subject="[asdasdas] assd asdasd" 
    

    第三に、簡単な解決策は、use git bundleになります。それはというファイルを生成します。あなたは任意の方法で送信でき、受信者はそこからプル/クローンを取り出せます。それは裸のgit repoとして(その1つのファイル)動作します。

    +0

    http://status.bitbucket.org/git send-email -1'で動作するはずです。しかし、 'git bundle 'は簡単です。 – VonC

    +0

    はい私は電子メールを送信することができますが、Subject行は--subjectに入力したものではなく、git commit -m "line"で使用した行に変更されます – Haswell

    +0

    また、[Patch]も件名に追加されます。 git bundleはこれを解決できますか? – Haswell

    関連する問題