私はグーグルで試してみて、https://help.github.com/en/articles/connecting-to-github-with-sshとさまざまなガイドを読みました。git push -u origin master
またはgit push origin master
(同じコマンド)を実行できません。
私は少なくとも2年ほどはgitアカウントを持っています。私はpush -u origin master
自分のラップトップで正常にリポジトリを作成できましたが、このデスクトップでは問題が発生しています。
これが私が試したものです:
1. gitユーザー名を設定しました
2. gitユーザーのメールアドレスを設定しました
3. /home/meder/.ssh/id_rsa.pubのコンテンツをgithubのアカウントページにアップロードしました。空白を貼り付けていないことを確認しました
4.次の内容で〜/ .ssh / configを作成しました:
Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
.sshを700、id_rsa 600に変更しました
5. タイプミスをせずに適切なリモートオリジンを追加しました。git remote add origin git@github.com:medero/cho.git
6.#5を確認するために、これが.git / configです。ディレクトリは正しく、別のディレクトリではありません:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:medero/cho.git
7. ssh git@github.com -v
認証が成功する
8.奇妙なことの1つは、あいさつするユーザー名にt
付加されていることです。私のgithubユーザー名はmedero
ではなくmedert
です。
こんにちはmederot!認証は成功しましたが、GitHubはシェルアクセスを提供していません。
9.プロキシやファイアウォールの背後にいない
10.キーが提供され、以下からの出力が表示され-v
ます。
debug1: Host 'github.com' is known and matches the RSA host key. debug1: Found key in /home/meder/.ssh/known_hosts:58 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering public key: /home/meder/.ssh/id_rsa debug1: Remote: Forced command: gerve mederot debug1: Remote: Port forwarding disabled. debug1: Remote: X11 forwarding disabled. debug1: Remote: Agent forwarding disabled. debug1: Remote: Pty allocation disabled. debug1: Server accepts key: { some stuff, dont know if i should share it debug1: Remote: Forced command: gerve mederot debug1: Remote: Port forwarding disabled. debug1: Remote: X11 forwarding disabled. debug1: Remote: Agent forwarding disabled. debug1: Remote: Pty allocation disabled. debug1: Authentication succeeded (publickey).
11.これが私が使ったコマンドです
mkdir cho
git init
touch README
git add README
git commit -m 'test'
git remote add origin git@github.com:medero/cho.git
git push -u origin master
12.新しいSSHキーを作成したくありません。
13. sshを使用してgit cloneし、編集、コミット、およびgit pushを実行しても、まったく同じ結果が得られます。
14.実際のエラーは次のとおりです。
$ git push
ERROR: Permission to medero/cho.git denied to mederot.
fatal: The remote end hung up unexpectedly
15. githubユーザー名とgithubトークンを設定しました:
$ git config --global github.user medero $ git config --global github.token 0123456789yourf0123456789tokenシステム上のすべてのgitインスタンスのGitHubトークンを設定します
16.私のgithubユーザー名がNOTでmederot
あり、私のgithubトークンがアカウントページごとに正しいことを確認しました(最初の2文字と最後の2文字が検証されています)。
17.#16を確認するには、〜/ .gitconfigに
[github]
token = mytoken...
user = medero
18.それがssh-key add ~/.ssh/id_rsa
必要なら私もしました...
理論:
sshが認証されると、ユーザーの挨拶がmederot
でありmedero
、それが私のアカウントではないので、何か怪しいものがあると思います。私のgithubアカウントの何かが誤ってキャッシュされる可能性はありますか?
また、ローカルのsshキャッシングの奇妙さを疑っています。なぜなら、i mv ~/.ssh/id_rsa KAKA
とmv ~/.ssh/id_rsa.pub POOPOO
、およびを実行ssh git@github.com -v
した場合でも、それは私を認証し、名前を変更したときに/home/meder/.ssh/id_rsaにサービスを提供すると言っているからです。キャッシュする必要がありますか?