How to push your file to git hub?
Published: 2022-09-04 22:29:51

**The first way**
Commit Local repository to Remote repository

**1) Create directory and some files on your computer**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t1a3r6tnyvk2ibod3mdh.png)

**1) Create Remote repository on git hub**
Push "new button"
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6plx00hapl6n4rog9q0b.png)
set about repository name, Public or Private, if you need add a README file.
Then push Create repository.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5fa8rs0hz4eyk6fwy7qx.png)
Did it!
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lv8fn0u956idzrv8hio5.png)

**2) Create Local repository on directory you just made**
Command: git init
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fpct2y2miqbzkbz5hat0.png)
-git folder(hidden) appear
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3gxbf943g4yv9f82ylwq.png)

**3) Add file to index**
?What is Index?
-Index is an area where changes are temporarily stored before commit, and only files added to the index are subject to commit.
command: git add bun.index(👈file's name)
;If you want to commit all files, command: git add .
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q7yk9bqi1t3qwf5k5eko.png)

**4) Commit file to local repository**
?What is Commit?
-Commit means the operation of reflecting file additions and changes in the local repository.
Command: git commit -m "some comment"(👈kind of memo)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bm47mkifz7g04p6923ph.png)
You can check the change history including commit messages by entering git log command.
Command: git log
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hl92hxxarv0n9uuwh8n9.png)
When you want quit checking log, please enter "q".

**5) Linking local and remote repositories**
Command: git remote add origin repository's URL(👈You can copy this from your git hub)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2a9bb2fmdwn1fawnq3mc.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ckacoumu31yt34rs5180.png)

**6) Push file to remote repository**
?What is Push?
-Push is to reflect changes in a local repository to a remote repository on GitHub.
Command: git push origin branch's name(👈You can check with command: git branch)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/glzt3juh11fzcilawv64.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ckg0wfquu38h921bdegq.png)

Ta-da!
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zyc9u6py890uxxy1kksl.png)


**The second way**
Clone source codes from Remote repository on your Local

**1) Clone source codes from Remote repository**

**2) Make your branch**
?What is branch?

**3) Commit files to branch you made**

**4) Push file to remote repository**


reference(Japanese)
https://tech-blog.rakus.co.jp/entry/20200529/git