git commit コマンドを入力したあと git remote add でbitbucket.org にリポジトリを作成してみた。
$git init
$git commit -am "コメント"
問題はこの後、
$git remote add origin [email protected]:ユーザー名/○○.git
ユーザー名のところは bitbucket.org で設定している自分の名前
○○ のところはリポジトリの名前
$git push -u origin --all
<=================↓エラー↓===========>
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
<====================================>
この時パーミッションの文のところを理解できず手当たり次第に試してみたらうまくいってしまった。
ssh鍵の再発行
$ssh-keygen -t rsa -C bitbucketに登録してるメールアドレス
全部enter押した
ssh鍵の取得
$cat ~/.ssh/id_rsa.pub
表示された文字をすべてコピペ
ssh鍵をbitbucket.orgに再登録
vimコマンドと呼ばれるものを初めて触った。
$vi ~/.ssh/config
ターミナルみたいなやつが出てきてしたのほうにINSERTみたいな感じで書かれてるときは長文コマンドの入力ができて、一度ESCキーを押すと:wqをおして保存終了ができる流れのようだ。長文コマンドの際に以下を入力
Host bitbucket
HostName bitbucket.org
IdentityFile ~/.ssh/id_rsa
User git
$Esc
$:wq
再度実行
$git push -u origin --all
<=========エラー=====>
Bad owner or permissions on /home/ユーザー名/.ssh/config
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
<====================>
ここでパーミッションに気づく
$chmod 600 ~/.ssh/config
$git push -u origin --all
これでうまくいった。
結論:なんか最後のやつだけでよくないですか?
Author And Source
この問題について(git commit コマンドを入力したあと git remote add でbitbucket.org にリポジトリを作成してみた。), 我々は、より多くの情報をここで見つけました https://qiita.com/masa0/items/5b778ef039505674ad13著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .