Github Commit and Push command (Memorandum)

# How to Github
## For busy people
I got you. All you need is these.

### For new projects
```Terminal:Terminal
cd .../.../.../project_name
git config --global user.email your-mail-address@mail.com
git config --global user.name username
git init
git add .
git commit -m "comments"
git remote add origin your-repository-url.com
git push origin master
```

### For registered projects
```Terminal:Terminal
cd .../.../.../project_name
git add .
git commit -m "comments"
git push origin master
```

# Prerequisite
If you are totally new to programming and 'githubbing', you might not have an account for Github.

### 1. Get an account
Please get an account at [Github](https://github.com/).

### 2. Create a sample project
I suppose you've got something. You surely do not need any large projects to show. 

**If you don't got any**, just copy the code below and paste it to memo. Then save it as **sample.py**.

```python:sample.py
print('Hello, noobs!')
```

# How to commit and push a project to Github

It's not hard. only takes about 5 minutes as whole process.

## 1. Register a project to Github
First, login to Github and create a new repository. You can also do that by accessing this link.
https://github.com/new

![Create_a_new_repo](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3586840/de647793-3de7-6056-3a2e-cd42496ed242.png)

## 2. Go to the Terminal you were working on
Just got to the terminal.
```Terminal: Terminal
cd /Users/Username/Desktop/project
```

## 3. Setting up your user info 
Setting up your user info. Write your username and mail address that you've used to setup a Github account.
```Terminal: Terminal
git config --global user.email "your-mail-address@mail.com"
git config --global user.name "your-user-name"
```
You might get the following error unless you do the setups above.

```Terminal:Error
Author identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.
```

## 4. Initializing Git
Initialize Git. Yeah, initialize it, ... initialize.

```Terminal:Terminal
git init
```

## 5. Add files that you've changed
The dot means adding all the files you've changed. It might take a while.
```Terminal:Terminal
git add .
```

## 6. Commit the files
Commit it.
```Terminal:Terminal
git commit -m "any comments"
```

## 7. Register repository
Go to your github account and access the repository. Then copy the HTTPS link. 

![https_link](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3586840/7e35d406-aadb-cc84-f528-0e57130dd6fa.png)

Just paste it off. You don't need the parenthesis.
```Terminal:Terminal
git remote add origin (your-url-link)
```

## 8. Push the files
Finally, push the files to remote repository!

```Terminal:Terminal
git push origin master
```

There you have it. 

## Errors I got while pushing
I got this following error while pushing. 
```Terminal:Error
error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400
```

Solved it by running the code below.
```Terminal:Terminal
git config --global http.postBuffer 524288000
```
I also got this error. Too large.
```Terminal:Error
remote: error: GH001: Large files detected. You may want to try Git Large File Storage
```
Nothing you can do about it. Maybe trying **Github Pro** would help? but who knows.
![Github-pro](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3586840/ce1eb036-9a7a-67ac-0dc4-17875e5d2423.png)


### when asked for merge
```Terminal:Terminal
git merge --allow-unrelated-histories origin/main
```