auの日記

プログラミング初心者の日記。(auはハンドルネームです)

Githubに実際にpush

auです。

今回は、前に作ったジャンケンゲームのプログラムをGithubに実際にpushしてみました。

最初に、Githubのサイトにいき、ログインします。


github.com


ログインしたら、コマンドプロンプトでプッシュしたいフォルダまで移動します

cd C:\Users\ユーザ名\Documents\Intern\Intern\Janken #ここは人によって異なります
git clone [URL]

でクローンするはずでしたが、自分は

git clone 

だけでやってしまい、Helpがいっぱいでてきました。
終わったら、次に

git init

と入力します。
すると

Reinitialized existing Git repository in C:/Users/ユーザ名/Documents/Intern/Intern/Janken/.git/

と、最後に「.git」がつきます。
次に、先ほど入手したのを最後につけて

git remote add origin https://github.com/K-au/Janken-game.git

と入力します。
次に

git fetch origin

と入力して、

git branch -a

と入力します。
すると

* master

ブランチが終わったという意味だと思います。
次に

git push -u origin master
fatal: HttpRequestException encountered.
   この要求の送信中にエラーが発生しました。
Username for 'https://github.com': K-au
Password for 'https://K-au@github.com':
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (7/7), 1007 bytes | 0 bytes/s, done.
Total 7 (delta 0), reused 0 (delta 0)
To https://github.com/K-au/Janken-game.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

と入力します。なぜかこのときにエラーが起きましたが、ちゃんとできていた?と思うので良かったと思います。
その後にもう一度cloneしましたが

git clone https://github.com/K-au/Janken-game
fatal: destination path 'Janken-game' already exists and is not an empty directory.

となり、すでに'janken-game'はcloneされているとでています。
f:id:program-shoshinsya:20180308223201p:plain
なぜか自分の名前が二つあるのがほんとになんでかわかんないです。しかし、ちゃんとプッシュできているのがわかったのでよかったです。