10
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

BacklogのGitをSSHでクローンする方法

Posted at

やりたかったこと(できなかった)

自分以外の人も使う環境にGitのリポジトリをクローンして使いたい。
他の人も使うからパスワードは使わずに鍵でクローンしたい。
GitHubでもある方法をBacklogでもやりたい。
が、鍵は個人にしか設定できず・・・同じ鍵はほかの人で設定しようとするとエラーになって設定できなかった。
残念。
SSHの方法だけメモしておく。

BacklogのGitをSSHでクローンする方法

  • 環境
    • CentOS Linux release 7.8.2003 (Core)
    • git version 1.8.3.1

ssh-keygenで鍵を作る

# 1. RSA鍵のペアを作成する
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ponsuke/.ssh/id_rsa): #  <<<< Enter(鍵を作成する場所)
Created directory '/home/ponsuke/.ssh'.
Enter passphrase (empty for no passphrase): # <<<< Enter(パスフレーズ)
Enter same passphrase again: # <<<< Enter(パスフレーズ)
# ...省略...

# 2. 公開鍵を表示してコピーする
$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAA...

Backlogに公開鍵を登録する

SSH接続設定|サル先生のGit入門【プロジェクト管理ツールBacklog】の「BacklogにSSH鍵を設定したい」の方法に従って公開鍵を登録する

設定ファイルを書く

# 1. configに設定を書く
$ vi ~/.ssh/config
$ cat ~/.ssh/config 
# BacklogのGit
Host backlog
    HostName ponsuke.git.backlog.jp
    User ponsuke
    IdentityFile ~/.ssh/id_rsa

# 2. configのへのアクセス権限をつける
$ chmod 600 ~/.ssh/config

# 3. SSH接続を確認する
$ ssh -T backlog
The authenticity of host 'ponsuke.git.backlog.jp (12.134.567.89)' can't be established.
RSA key fingerprint is SHA256:vUgu+kx036pk/3Za77wrtd/+3nNsamN/C/+ncbV/20g.
RSA key fingerprint is MD5:25:c4:1e:3b:c5:5w:dw:7b:e3:3f:d5:3d:ac:84:c8:4d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ponsuke.git.backlog.jp,12.134.567.89' (RSA) to the list of known hosts.
Hi ! You've successfully authenticated, but Backlog does not provide shell access.

リポジトリをクローンする

$ git clone backlog:/PROJECT/src-ponsuke.git
Cloning into 'src-ponsuke'...
remote: Enumerating objects: 158, done.
remote: Counting objects: 100% (158/158), done.
remote: Compressing objects: 100% (124/124), done.
remote: Total 158 (delta 55), reused 0 (delta 0)

Receiving objects: 100% (158/158), 2.38 MiB | 0 bytes/s, done.
Resolving deltas: 100% (55/55), done.
10
12
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
10
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?