gitは削除されたリポジトリのリモート情報を保持します。

gitは削除されたリポジトリのリモート情報を保持します。

ストレージを複製できなくなりました。

$ git clone [email protected]:myaccount/myrep.git
Cloning into 'myrep'...
conq: repository does not exist.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

問題は、私のSSHid_rsaキーがまだ同じであるということです。とにかく、それを再生成してBitBucket自分のアカウントのSSHキーで更新した後にリポジトリを複製しようとすると、同じエラーが発生します。私は別のコンピュータ(redhat)で同じプロセスを試しましたが、git cloneが機能しました。だから何が起こりましたgit

次に、別のgitバージョンのプロジェクトに移動します。

$ cd share-repo

$ ls -a
./          ../         .git/       .gitignore* f1*         f2*

git configファイルを印刷します。

$ cat .git/config
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = [email protected]:myaccount/share-repo.git
[branch "master"]
[user]
    name = myaccount

私は試してみますpull

$ git pull -v
conq: repository does not exist.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

さて、プッシュしてみましょうか?

$ git push -v origin master
Pushing to [email protected]:myaccount/p2.git
conq: repository does not exist.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

ああ?Gitリポジトリp2にプッシュしてみますか?プッシュを試してくださいshare-repo。 p2というリポジトリにプッシュを正確にどのように試していますか?実はp2今朝というリポジトリがありましたが、テストをしてからアカウントから削除し、BitBucketパソコンから関連フォルダを削除しました。情報はp2どのように保存されますか?最も重要なのはどこに保存されており、どのようにリセットできますか?gitp2

$ git remote -v
origin  [email protected]:myaccount/p2.git (fetch)  # ?!
origin  [email protected]:myaccount/p2.git (push)   # ?!
origin  [email protected]:myaccount/share-repo.git (push)

奇妙なことに、以前に見たように、このgit configファイルにはrepoに関する情報のみが含まれていますshare-repo。また、フォルダ全体で文字列p2を見つけました。

$ grep -Rin p2 ../share-repo/
# Nothing

p2というリポジトリを手動で再作成しましたBitbucket。私はそれを複製しようとしています:

$ cd ..

$ git clone [email protected]:myaccount/p2.git
Cloning into 'p2'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.

$ cd p2

$ cat .git/config 
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "origin"]
    url = [email protected]:myaccount/p2.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master

$ git remote -v
origin  [email protected]:myaccount/p2.git (fetch)
origin  [email protected]:myaccount/p2.git (push)
origin  [email protected]:myaccount/p2.git (push)

さて、それはうまくgit cloneいきましたが、今は2つの追加のリモートコントロールワイヤを参照しており、そのうちの1つは重複しています。リポジトリを使用するときに追加の行を覚えていますかshare-repo?これは最初の2行に関するもので、まだ私が削除した古いp2リポジトリに関連しています。

いくつかの変更を適用しましょう。

$ git touch .gitignore

$ git add .gitignore

$ git commit -m "first commit"

$ git push -v origin master
Pushing to [email protected]:myaccount/p2.git
Counting objects: 3, done.
Writing objects: 100% (3/3), 216 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To [email protected]:myaccount/p2.git
 * [new branch]      master -> master
updating local tracking ref 'refs/remotes/origin/master'
Pushing to [email protected]:myaccount/p2.git
To [email protected]:myaccount/p2.git
 = [up to date]      master -> master
updating local tracking ref 'refs/remotes/origin/master'
Everything up-to-date

だからgitはp2リポジトリにプッシュし、2番目に試みます。両方のリポジトリは、自分のbitbucketアカウントの名前と場所が同じであるため、すべてが最新であることは明らかです。

p2これで、リポジトリが自分のアカウントに存在する限り、目的のリポジトリを複製できますBitbucketpushたとえば、いくつかの変更を適用するとshare-repo機能しますが、gitは同じ変更をリポジトリにプッシュしようとしますp2。私はどのように修正するのか分からない混乱に陥った。

要約すると、今朝にというリポジトリがありましたが、p2ここから削除しbitbucketてからマイコンピュータからそのフォルダを削除しました。その後、どのgitプロジェクトに入っても、cd現在作業しているリポジトリの上にすでにgit remote -v最新のリポジトリに関する情報があることを示しています。p2Gitアップデートコマンド(clone、push、pull)は、私がp2そうしないと機能しませんBitbucket。そうすると、git updateコマンドは私が作業している現在のリポジトリとリポジトリp2にコマンドを適用します。

p2今日削除したリポジトリがこれだけではなく、ここで何が起こっているのか疑問に思います。

私は私が受け取ることができるすべての助けを喜んで受け入れます。

ベストアンサー1

解決しました。私は言う。 bashオートコンプリート(タブ)を使用してファイルをすばやくスキャンしましたが、うまくいかなかったため、~/.git-whatever問題が別の場所に盲目的にあると仮定しました。 Patrickのコメントは次のとおりです。使い方を再確認し、彼が書いた内容がls -a ~/実際~/.gitconfigにここにあり、リモコンに関する情報が含まれています。

$ cat ~/.gitconfig
[user]
   name = myaccount
   email = [email protected]
[remote "origin"]
   push = [email protected]:myaccount/p2.git

今、その理由を覚えています。実験中にこのコマンドを使用し、他のグローバル構成を変更しました。ファイルに変更がないため、何をしているのかわかりません。git config --global remote.origin [email protected]:myaccount/p2.git--globalrepo/.git/config


Git 設定に関する追加ドキュメント:https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration

おすすめ記事