> For the complete documentation index, see [llms.txt](https://stb11816.gitbook.io/python_note/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://stb11816.gitbook.io/python_note/git.md).

# Git

```
# 下載專案
git clone [url] [dirname]

# 列出目前可用的branch，也可看現在屬於哪個branch
git branch

# 切換branch
git checkout [branch name]

# pull
git pull

# push
git push

# commit
git commit -m ['message']

# 比對工作目錄及暫存區域的差異
git diff
```

參考連結：\
<https://code.yidas.com/git-commands/>

```
# 復原檔案
git checkout -- [filename]

# 查詢專案狀態，那些已被修改之類的
git status
```

參考連結：\
<https://zlargon.gitbooks.io/git-tutorial/content/file/recover.html>

驗證問題(self signed certificate in certificate chain)

```
git config --global http.sslVerify false
```

<https://blog.csdn.net/officercat/article/details/39989837>

<https://devmanna.blogspot.com/2018/06/git-remote-ssl-certification-problem.html>

在linux使用ssh key驗證github (ssh-add)

<https://www.cnblogs.com/Security-Darren/p/4106328.html>

## gitlab

新增ssh key

<https://sinyilin.github.io/git/20191024/1014042378/>

如果可以成功clone但是無法push

<https://blog.csdn.net/zzh920625/article/details/78087669>
