質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Git

Gitはオープンソースの分散バージョン管理システム(DVCS)です。

バージョン管理

バージョン管理はコンピューター上にファイルとして格納されているドキュメント・プログラム・その他の情報の変更履歴等を管理するものです

BitBucket

BitBucketは無料のリポジトリ管理ホスティングサービスです。 MercurialとGitのVCSに対応しています。プライベートリポジトリを、制限なく作成することが可能です。

Q&A

解決済

2回答

2987閲覧

git コマンドのみでbitbucketに非公開リポジトリを作りpushしたい

earnest_gay

総合スコア615

Git

Gitはオープンソースの分散バージョン管理システム(DVCS)です。

バージョン管理

バージョン管理はコンピューター上にファイルとして格納されているドキュメント・プログラム・その他の情報の変更履歴等を管理するものです

BitBucket

BitBucketは無料のリポジトリ管理ホスティングサービスです。 MercurialとGitのVCSに対応しています。プライベートリポジトリを、制限なく作成することが可能です。

0グッド

0クリップ

投稿2018/02/03 08:04

件名のままなのですが、sourcetreeに甘えていて、いざターミナル内からのCUI操作で件名のことをしようとしてもできません、、、

イメージ説明

sourcetreeでは毎回パスワード入力が面倒なので公開鍵のssh接続でpushとかしています。
ペアキーは~/.sshにあります。
で、今回つまづいているのがXSERVER内での出来事。

[mg1986jp@sv5015 scripts]$ git push warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Warning: Permanently added the RSA host key for IP address '104.192.143.1' to the list of known hosts. Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. [mg1986jp@sv5015 scripts]$

解決法として、XSERVER内のプロジェクトをPC(mac)側に持ってきて、sourcetreeでbitbucketに非公開リポジトリを作って既存プロジェクトをその非公開リポジトリにpushすれば、あとはgitが使えるどっかのサーバーでcloneすれば解決はしますが、目的はGUIがなくてもできるようになること、、、コマンドでやりたいんですなぁ、、、GUIがない現場だと困りますからなぁ、、、

本題ですが、時系列で書いていきますね。

bitbucketのペアキーをとりあえず、XSERVER内の~/.sshにも設置。

MG-MacBook-Pro:~ MacPRO-N-GOTO$ scp -i ~/.ssh/xserver_mg1986jp -P 10022 ~/.ssh/mg1986jp-Bitbucket.pub mg1986jp@mg1986jp.xsrv.jp:.ssh/ Enter passphrase for key '/Users/MacPRO-N-GOTO/.ssh/xserver_mg1986jp': mg1986jp-Bitbucket.pub 100% 781 46.2KB/s 00:00 MG-MacBook-Pro:~ MacPRO-N-GOTO$ scp -i ~/.ssh/xserver_mg1986jp -P 10022 ~/.ssh/mg1986jp-Bitbucket mg1986jp@mg1986jp.xsrv.jp:.ssh/ Enter passphrase for key '/Users/MacPRO-N-GOTO/.ssh/xserver_mg1986jp': mg1986jp-Bitbucket 100% 3326 181.7KB/s 00:00

pushができるようにコミットまでしとく。

MG-MacBook-Pro:.ssh MacPRO-N-GOTO$ ssh -l mg1986jp -i ~/.ssh/xserver_mg1986jp -p 10022 mg1986jp.xsrv.jp Enter passphrase for key '/Users/MacPRO-N-GOTO/.ssh/xserver_mg1986jp': Last login: Fri Feb 2 23:16:58 2018 from 39.23.149.210.bf.2iij.net [mg1986jp@sv5015 ~]$ cd scripts/ [mg1986jp@sv5015 scripts]$ git init Initialized empty Git repository in /home/mg1986jp/scripts/.git/ [mg1986jp@sv5015 scripts]$ git config --global user.email "git@xsrv.co.jp" [mg1986jp@sv5015 scripts]$ git config --global user.name "MasayaGoto" [mg1986jp@sv5015 scripts]$ git add clone_execution_and_project_switching.sh [mg1986jp@sv5015 scripts]$ git commit -m "デプロイ用スクリプト" [master (root-commit) 537af12] デプロイ用スクリプト 1 file changed, 236 insertions(+) create mode 100755 clone_execution_and_project_switching.sh [mg1986jp@sv5015 scripts]$ git status # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # .htaccess.model # clone_execution_and_project_switching.sh.bk nothing added to commit but untracked files present (use "git add" to track) [mg1986jp@sv5015 scripts]$ git remote add origin git@bitbucket.org:mg1986jp/scripts.git [mg1986jp@sv5015 scripts]$ git push origin warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. [mg1986jp@sv5015 scripts]$

コマンドはcheckoutやfetchやmergeはよく使うのでいいのですが、初回セットアップ系は「あれ?どうすんだっけ、、、」ってなります。
GUIは楽ですが慣れすぎると怖いですね。
どこか抜けがありますでしょうか。

とりあえず、非公開リポジトリを作ってそこにpushまでしたいです、、、

今回初めてbitbucket使います。
別に現場で使うわけじゃなくて(というか使ってる現場みたことない)個人でよく依頼を受けるので、保存先どうするかと悩んでいて無料無制限非公開リポジトリが売りのbitbucketを選定しました。
githubの方が慣れてるんですけど、個人依頼なのでチームで作るわけじゃないので、そして、たかだか5$されど5$、、、

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

既にクローズとなっていますが、こちらの方がCUIベース(REST API)で実現されているようです。(gitコマンドではないですが…)
Bitbucket使ってみるメモ③-linux側で新規リポジトリの作成からgitのcommit&pushまでメモ(Bitbucket REST API)

参考まで。

投稿2018/09/08 10:39

tiger-teratail

総合スコア8

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

ベストアンサー

Bitbucketは、WEB上でリポジトリ作成できるのでそれが一番楽ですよ。
リポジトリ作成した後に、説明も表示してくれて、その通りにやればローカルのgitリポジトリと簡単にリモート連携もできます。

GitHubも同様ですが、SourceTreeでリポジトリ作るほうがなんとなく違和感があります。

投稿2018/02/03 08:09

dala00

総合スコア441

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

earnest_gay

2018/02/03 08:12

回答ありがとうございます。 それは知っているのですが、「目的はGUIがなくてもできるようになること、、、コマンドでやりたいんですなぁ、、、」なので、、、 SourceTreeから非公開リポジトリで作ることができるなら、なにかコマンドがあるはず、、、だと思っています。
dala00

2018/02/03 08:14

SourceTreeは多分API連携では? gitでの操作で作成されているのではない気が…。
earnest_gay

2018/02/03 08:15

なるほどお!ありえますね。 時間無駄にしてしまいそうなのでブラウザで作っときますmm
yumetodo

2018/02/03 08:52

API叩くプログラムを自分で書くよりは(そもそも公開APIなのか?)素直にWebでRepo作るべきですね
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問