gitとGitHubの設定
前提条件
SSH Keysはなかったので取得する
自分のパソコンがSSH Keysを持っているか確認
$ ls -al ~/.ssh
~/.ssh
フォルダはあったが、
id_rsa.pub
はなかったので、
SSH Keyを取得。
$ ssh-keygen -t rsa $ cat ~/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1y〜〜〜〜〜〜〜〜 ユーザー名.local
id_rsa.pub
の中身をコピーする。
ssh-rsa
から .local
までコピーのこと。
GitHubにSSH Keys登録
Githubにログインし、 settings
→ SSH and GPG keys
New SSH Key
を押してtitleとkeyを入力。
titleは適当に。keyはさっきコピーした
ssh-rsa ~~.local
を貼り付け。
Add key
を押してgitとgithubを連携。
dotfileの設定
dotfilesに集める
~/projects/dotfiles
というフォルダを作成し、
~/.emacs.d
を dotfiles
下にコピー。
そして、
$ cd ~/ $ ln -s /Users/ユーザ名/projects/dotfiles/.emacs.d .emacs.d
とシンボリックリンクを張る。emacsアプリは、 ~/.emacs.d
を見に行くが、実体は ~/projects/dotfiles
にあるという寸法。
dotfilesフォルダをGitにコミット
$ cd ~/projects/dotfiles $ git init $ git add . $ git commit -n "First commit"
GitHubへプッシュ
$ git remote add origin git@github.com:ユーザ名/dotfiles.git
$ git push -u origin master
ただいまの問題
ということで、プッシュできたんだけれど、
.emacs.d
が登録されない(登録されるけどGitHubで開けない?)。
これでいいのか悪いのかがわからない現在。
⇒たぶんダメで。Preludeを入れているからだったっけ、.emacs.d/.git
が元々入っているようで、たぶんそのせいで~/xxx/dotfilesde
$git add .
をしようとすると警告が出る。それが影響していると
思うんだけど、追跡しきれず。バタリ。
$ git add . warning: adding embedded git repository: .emacs.d 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> .emacs.d hint: hint: If you added this path by mistake, you can remove it from the hint: index with: hint: hint: git rm --cached .emacs.d hint: hint: See "git help submodule" for more information.
参考サイト(と書籍)
MacでGitHubを使う手順 – SSH Keysの登録 / リポジトリの作成 / 基本コマンド
『Emacs実践入門』大竹智也