LoginSignup
1
0

More than 3 years have passed since last update.

git commit コマンドを入力したあと git remote add でbitbucket.org にリポジトリを作成してみた。

Posted at

$git init
$git commit -am "コメント"
問題はこの後、
$git remote add origin git@bitbucket.org:ユーザー名/○○.git
ユーザー名のところは bitbucket.org で設定している自分の名前
○○ のところはリポジトリの名前
$git push -u origin --all
<=================↓エラー↓===========>
git@bitbucket.org: 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
これでうまくいった。

結論:なんか最後のやつだけでよくないですか?

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0