git操作のよくあるエラーと解決方法---(実戦性総括)


文書ディレクトリ
  • 1.GitBashはWebStormの
  • に構成されています.
  • 2.git pull/git pushが毎回ユーザー名パスワードを入力する問題を解決する
  • 3.Git操作fatal:Authentication failed for'http://************
  • 4.error: could not lock config file C:/Program Files/Git/mingw64/etc/gitconfig: Permission denied
  • 5.RPC failed; HTTP 411 curl 22 The requested URL returned error: 411 Pushing to "http://……"
  • 6.fatal: not a git repository (or any of the parent directories): .git
  • 7.There is no tracking information for the current branch.Please specify which branch you want to merge with.
  • fatal: 'origin' does not appear to be a git repository
  • 8.fatal: branch 'master' does not exist

  • 1.GitBashをWebStormに設定
    File->settings->Tools->Terminal Shell Pathのcmdを変更する.exeはsh.exeのパスです
    注意:ここのパスはsh.exeのパスはgitbashではありません.exeのパス
    "C:\Program Files\Git\bin\sh.exe" --login -i
    

    git 操作常见错误及解决方式---(实战性总结)_第1张图片
    2.git pull/git pushが毎回ユーザー名パスワードを入力する問題を解決する
    この問題の原因はgit cloneがコードをダウンロードするときのリンクがhttps://ではなくgit@git(ssh)の形式でgit pull/pushをリモートに操作すると、いつもアカウントとパスワードを入力して操作に成功するように要求されます.解決方法:プロジェクトディレクトリで実行
    git config --global credential.helper store
    

    この操作はローカルでテキストを生成し、アカウントとパスワードを記録し、上記のコマンドを使用して構成した後、git pullをもう一度操作します.その後、アカウントのパスワードを入力するように要求されます.今回はパスワードを再入力する必要はありません.
    3.Git操作fatal:Authentication failed for'http://********
    認証に失敗し、ユーザー名パスワードをポップアップしない問題解決:次のコマンドを実行してユーザー名パスワードキャッシュをクリアします.
    git config --system --unset credential.helper
    

    4.error: could not lock config file C:/Program Files/Git/mingw64/etc/gitconfig: Permission denied
    Permission deniedの場合は、管理者権限の下でPowerShellを開いて実行する必要があります.
    git config --system --unset credential.helper
    

    5.RPC failed; HTTP 411 curl 22 The requested URL returned error: 411 Pushing to “http://……”
    エラーの原因:gitはhttp postの大きさを通じて制限の解決方法があります:git config http.postBuffer 524288000はアップロードする最大のデータ量を設定して50 MBです
    6.fatal: not a git repository (or any of the parent directories): .git
    エラーの原因:git cloneリモートプロジェクトがローカルに到着すると、git add .などの他のgitコマンドが実行され、現在の操作ディレクトリにないことを示す.gitファイル、つまり現在Git上のリモートウェアハウスディレクトリが1つもないため、Gitコマンド設定は無効です.解決策:git initコマンドを入力すると、新しい空の倉庫を作成したり、既存のプロジェクトをバージョン管理に組み込んだりできます.
    7.There is no tracking information for the current branch.Please specify which branch you want to merge with.
    エラー原因:git pullコマンド実行時に現在のブランチに追跡情報がないことを示す解決方法: 1.直接指定遠隔ブランチ git pull remote branch例えばgit pull origin master 2.もう1つの方法は、ローカルマスターをリモートマスターに指定してからpullgit branch--set-upstream-to=remote/branch master、例えばgit branch --set-upstream-to=origin/master masterに行くことです.
    fatal: ‘origin’ does not appear to be a git repository
    fatal: Could not read from remote repository. エラーの原因:git clone~~を実行してリポジトリをクローンすると、デフォルトのリモート・起点が自動的に作成されます.リポジトリがgit initによって作成されている場合は、remoteもoriginもなく、自分で設定する必要があります.解決策:git remote add origin Repo urlは、データを交換する既存のリモート・リポジトリへのパスです.ローカルディスクにある場合はfile://home/me/fooです.Git or/home/me/foo. 飯桶.Githubで管理されている場合はhttps://Github.com/me/foo.gitまたはssh://[email protected]/me/foo.git. 参考答案
    8.fatal: branch ‘master’ does not exist
    エラーの原因:1.ローカルにローカル倉庫を作成する2.関連リモート: git remote add [email protected]:ユーザー名/リモート・ライブラリ名.git 3.リモートウェアハウスをローカルに同期する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 branch --set-upstream-to=origin/master masterを実行します.fatal: branch 'master' does not existをエラーで報告し続けます.ローカルウェアはmasterにないので、解決方法を間違えました.ローカルウェアでmasterに切り替えます.git checkout masterでは、同期したばかりのファイルが出てきます.ここで実際のリモートエンドの他のブランチも同期しました.しかしgit branchは直接git checkoutブランチ名を示さずに直接切ることができますここでgit cloneを使うと[email protected]:ユーザー名/--リモートボックスをクローンすると、masterとブランチが表示されます.実际:试してみても同じgit branchでも分岐は见えませんでしたが、実际にダウンロードしました.