個人的なメモ

技術メモがメインです.本ブログはあくまで趣味です.

Initialize git

Initialize git

keyword git, linux, install

Install

sudo apt-get update
sudo apt-get install git
git --version

set config

git config —global user.name <user name>
git config —global user.email <mail address>

To confirm:

git config --global --list

Create repository

git init # initialize
git add .
git status
cit commit -m "Fiest commit"

To resister repository:

git remote add origin <URL>
git remote -v
git push origin master

add SSH

Error

git push origin master
Permission denied (publickey). fatal: Could not read from remote repository.  Please make sure you have the correct access rights and the repository exists.

Create key

$ ssh-keygen -t rsa -C mail@mail.com
Enter file in which to save the key (/home/xxx/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

Copy and paste key

ls ~/.ssh/
id_rsa id_rsa.pub

Access github and go to settings -> SSH and GPG keys

set config

vim ~/.ssh/config

Host github
  HostName github.com
  IdentityFile ~/.ssh/id_rsa
  User git

Check connection

ssh -T git@github.com
Hi xxxxxxxxx! You've successfully authenticated, but GitHub does not provide shell access.