GitHubへ公開鍵(public key)を登録する / 作業ディレクトリ内に空のローカルリポジトリを作成する / 作業ディレクトリにあるファイル、ディレクトリをコミットする

カテゴリー: GitHub  閲覧数:564 配信日:2019-06-21 13:44


GitHubへ公開鍵(public key)を登録する


コマンドラインからgitコマンドをたたいてpushするためには?
上記で作成したキーペアのうち公開鍵(public key)をGitHubへ登録する必要がある

公開鍵
C:/Users/Windowsユーザー名/.ssh/id_rsa.pub

[New SSH key]をクリックし、コピーした上記ファイル内容をペースト
これでGitHubに公開鍵が登録される
SSH and GPG keys

$ ssh -T git@github.com
The authenticity of host 'github.com (52.69.186.44)' can't be established.
RSA key fingerprint is SHA256:xxxx.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com,52.69.186.44' (RSA) to the list of known hosts.
Enter passphrase for key '/c/Users/user/.ssh/id_rsa':
Hi GitHubユーザー名! You've successfully authenticated, but GitHub does not provide shell access.


$ git clone git@github.com:GitHubユーザー名/GitHubリポジトリ名.git
Cloning into 'P46'...
Enter passphrase for key '/c/Users/user/.ssh/id_rsa':
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.


作業ディレクトリ内に空のローカルリポジトリを作成する


Git BASH を開く
GIT管理下におきたい作業ディレクトリへ移動

cd
作業ディレクトリ(Lドライブの「/1_Hp/0_sakura/2018server/var/Www/html/1-p46/」)へ移動する
$  cd /L

同じドライブ内を移動
$ cd 1_Hp/0_sakura/2018server/var/Www/html/1-p46

コピペ用
$ cd /L/1_Hp/0_sakura/2018server/var/Www/html/1-p46

git init
作業ディレクトリ内へ、Gitの(空の)ローカルリポジトリを作成する
$ git init
Initialized empty Git repository in L:/1_Hp/0_sakura/2018server/var/Www/html/1-p46/.git/


作業ディレクトリ内にバージョン管理用のリポジトリ( .git ディレクトリ)が生成された。
しかし、作業ディレクトリ内に存在するファイルは、まだそのリポジトリへ登録されていない

作業ディレクトリにあるファイル、ディレクトリをコミットする


git add -A
作業ディレクトリ内にあるファイルを全てコミット候補にする
$ git add -A
warning: adding embedded git repository: GitHubリポジトリ名
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint:   git submodule add <url> GitHubリポジトリ名
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint:   git rm --cached GitHubリポジトリ名
hint:
hint: See "git help submodule" for more information.


git commit -m
インデックスに追加されたファイルをコミットする(コミットメッセージも指定する)
$ git commit -m "first commit"
[master (root-commit) b39494a] first commit
1 file changed, 1 insertion(+)
create mode 160000 GitHubリポジトリ名


$ git commit -m "first commit"
On branch master
nothing to commit, working tree clean


週間人気ページランキング / 11-21 → 11-27
順位 ページタイトル抜粋 アクセス数
1 同じ携帯電話番号でも、複数の「Twitter Developers」アカウントを作成可能 | Twitter Developer(Twitter) 3
1 「Twitterデータ」対応 | Twitter Developer(Twitter) 3
1 Twitter カテゴリー 3
2 「Twitter API」は、2023 年 5 月 10 日時点では、SMS認証(電話番号登録)不要でプロジェクト作成できるよう仕様変更されています。 | Twitter API (Twitter) 2
2 「丁寧さ」をどうするの? / 以前作成したhelpを確認してみる / 色々迷う 2
2 ログイン 2
2 過去の「0文字引用RT」を期間指定して取得しようとするも、挫折 | Twitter API (Twitter) 2
3 統計 カテゴリー 1
3 Git 失敗履歴1。リポジトリ削除 → ソースコード削除 | GitHub(Git) 1
3 1.GitHub の GUI経由で リモートリポジトリを作成する / Git BASH / GitHubへ接続するために公開鍵を作成する 1
3 Webサービスビジネス カテゴリー 1
3 「インターネット計測とデータ解析 2010」視聴メモ | SFC(プログラミング) 1
3 Git BASH 経由で、Windows10 から GitHub へ PUSH する | GitHub(Git) 1
3 Q4.Hashtags must link to a Twitter search with the hashtag as the query 1
3 Twitter API 仕様 | Twitter Developer(Twitter) 1
3 GitHub への PUSH へ 1回成功したぐらいでは、Git 理解したことには全然ならない | Git BASH(Git) 1
3 1つの「Twitter Developers」アカウントから、複数のアカウントでPOST / 特徴 / 勘違いに気が付く 1
3 「ERROR: Repository not found. fatal: Could not read from remote repository.」と表示された場合は、 | Git BASH(Git) 1
3 よくある誤解 / 単なる携帯電話番号を入力してもダメ。SMS認証用コードを確認可能な電話番号が必須 1
3 Twitte API 使用の勘所 | Twitter Developer(Twitter) 1
2025/11/28 1:02 更新
指定期間人気ページランキング / 2020-5-27 → 2025-11-27
順位 ページタイトル抜粋 アクセス数
1 GitHubリモートリポジトリ名には日本語を使用できない。使用すると、ハイフンへ自動置換されてしまう | GitHub(開発環境) 1069
2 fatal: remote error: is not a valid repository name | Git BASH(開発環境) 748
3 Twitter アカウント管理 | Twitter Developer(Twitter) 622
4 開発 0 606
5 Twitter API | Twitter API (Twitter) 598
6 動画対応 | プログラミング 590
7 「Twitterデータ」対応 | Twitter Developer(Twitter) 566
8 Windows10で使用できるGitクライアント | GitHub(開発環境) 461
9 本 | ブックマーク 452
10 Webサービス | ブックマーク 425
11 マッチングサービス | Webサービスビジネス 404
12 同じ携帯電話番号でも、複数の「Twitter Developers」アカウントを作成可能 | Twitter Developer(Twitter) 368
13 TwitterOAuth では、画像URL を指定した画像投稿は出来ない(と思う)。ライブラリを使用しなければ出来るから、Twitter API の制限ではない(と思われる)  | Twitter 328
14 teratailでは質問しない | プログラミング 301
15 技術書籍 | プログラミング 300
16 気になった動画 | ブックマーク 294
17 埋め込みツイート | Twitter Developer(Twitter) 272
18 個人事業主 | Webサービスビジネス 250
19 Twitter 電話番号の問題 | Twitter Developer(Twitter) 234
20 コインチェック株式会社   | Webサービスビジネス 217
2025/11/28 1:02 更新