---
# System prepended metadata

title: Github tutorial

---

#    Github tutorial

nice title 哈哈把大家騙進來結果什麼都還沒打

####    註冊GitHub [click](https://github.com)
####    安裝Git  [click](https://git-scm.com/downloads)

---
###    Local Operation
-    ### Setting up
``` 
C:\> git config --global user.name "your_GitHub_name"
C:\> git config --global user.email "your_GitHub_email"
```

-    ### Create a folder for Git

```
C:\> mkdir GitHubex
C:\> cd GitHubex
C:\GitHubex> git init
```

-    ### Add a .py file into that folder
```python=
# main.py
print('Hello, World!')
```
Note that main.py is **NOT** tracked yet. You can type git status to check if files are tracked

-    ### Tracking file
```
C:\GitHubex> git add main.py
```

Main.py is tracked. Now we should move from stage to commit

-    ### Commit
```
C:\GitHubex> git commit -m 'Some Message'
```

Files are committed to repo

-    ### Branch
for versions
```
C:\GitHubex> git branch first_branch
C:\GitHubex> git branch
            first_branch
          * master
```
After creating a new branch, we add a new empty text file text.txt

```
C:\GitHubex> git checkout first_branch
C:\GitHubex> git add text.txt
C:\GitHubex> git commit -m 'with_text_file'
```

GitHubex
|
| -- -- main.py
| -- -- text.txt

```
C:\GitHubex> git checkout master
```

GitHubex
|
| -- -- main.py

---
###    Remote GitHub


-    ### Push
Create a new repo on GitHub and copy the URL
![](https://i.imgur.com/TkpFsJG.png)


```
C:\GitHubex> git remote add https://github.com/jimmy-12487/GUI_TEST.git
C:\GitHubex> git push --set-upstream origin master
```

-    ### Clone
```
C:\GitHubex> cd ..
C:\> mkdir GitHubex2 && cd GitHubex2
C:\GitHubex2> git clone https://github.com/jimmy-12487/GUI_TEST
```

-    ### Pull
-    ### Fetch
-    ### Merge