File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -123,4 +123,32 @@ git pull origin master
123123
124124### .gitignore
125125
126- ignore顾名思义是不提交到仓库。 在提交时,可以先确定哪些文件或目录需要ignore。
126+ ignore顾名思义是不提交到仓库。 在提交时,可以先确定哪些文件或目录需要ignore。
127+
128+ ## GitHub Authentication Tips
129+
130+ 应该通过命令行或 API 创建个人访问令牌(Personal Access Token)来代替密码。
131+
132+ 在使用GitHub API 或命令行时,可使用个人访问令牌 (PAT) 代替密码向 GitHub 进行身份验证。
133+
134+ ### 在命令行上使用令牌(Token)
135+
136+ 如果您有令牌,则可以在通过 HTTPS 执行 Git 操作时输入令牌,而不是密码。
137+
138+ 例如,在命令行中输入以下内容:
139+
140+ ``` text
141+ $ git clone https://github.com/username/repo.git
142+ Username: your_username
143+ Password: your_token
144+ ```
145+
146+ 个人访问令牌只能用于 HTTPS Git 操作。 如果您的仓库使用 SSH 远程
147+ URL,则需要[ 将远程 URL 从 SSH 切换到 HTTPS] ( https://docs.github.com/cn/articles/changing-a-remote-s-url/#switching-remote-urls-from-ssh-to-https ) 。
148+
149+ 如果没有提示您输入用户名和密码,说明您的凭据可能已缓存在计算机上。
150+ 您可以[ 在密钥链中更新您的凭据] ( https://docs.github.com/cn/articles/updating-credentials-from-the-osx-keychain ) ,用令牌替换您的旧密码。
151+
152+ ### Windows删除凭据
153+
154+ 进入"仓库根目录/.git",编辑"config"文件,将` [credential ".*.git"] ` 节中的` helper = .* ` 注释或删除,重新push,按照指引配置。
You can’t perform that action at this time.
0 commit comments