# 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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://stb11816.gitbook.io/python_note/git.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
