2018年3月21日水曜日

ubuntu上でgithubしてみる

github.comでリポジトリを作って,リポジトリをubuntu上にcloneして新しいディレクトリをpushするという流れ.

gitのインストール
$ sudo apt-get install git

githubのユーザ名・アドレスを設定
$ git config --global user.name "username"
$ git config --global user.email user@email.com

sshの公開鍵
$ ssh-keygen -t rsa -C "user@email.com"
return returnでパスワード設定
~/.ssh/id_rsa.pubに公開鍵ができる.中身をまるっとコピーしてブラウザからgithub.comでsetting>SSH and GPG keys,[New SSH key]でペースト.

次に予め作ってあったリポジトリをclone
$ git clone https://github.com/Organization/Repository 
現在のディレクトリにRepositoryがクローンされる.

$ cp -r made-dir Repository
$ cd Repository
$ git add made-dir
$ git commit -m 'any comment'
$ git push

これでgithub上にディレクトリを追加完了.

0 件のコメント:

コメントを投稿