Git用戶名密碼配置 以及Access denied解決方法


認證信息配置

# 配置用戶名
git config --global user.name "username"
# 配置密碼
git config --global user.password "password"
# 配置用戶郵箱
git config --global user.email "email"
# 保存認證信息
git config --global credential.helper store

常用命令

# 初始化一個倉庫
git init
# 從git站點  克隆倉庫   配置認證信息之后不需要每次輸用戶名密碼
git clone http://github.com/xxxxxxxxx
# 添加文件  新增文件或者修改文件之后,加入待提交文件中
git add readme.txt *.py
# 提交修改  需要在編輯器中輸入注釋信息,個人感覺很不好用
git commit 
# 提交修改與注釋
git commit -am "test commit a file update"
# 推送
git push
# 拉取最新代碼
git pull


# 克隆
git fetch sitename
# 查看狀態
git status


# 新建分支 1
git branch branch_name
# 新建分支2 
git checkout -b branch_name
# 獲取本地分支列表
git branch
# 切換分支
git checkout branch_name
# 合並分支
git merge branch_name
# 刪除分支
git branch -d branche_name


# 查看提交日志
git log
# 生成補丁文件
git format-patch master
# 添加補丁文件
git apply 0001-patch-file-name.patch


# 打標簽
git tag -a tagname -m "tag description"
# 查看標簽
git tag
# 刪除標簽
git tag -d tagname


# 萬能
git --help
git branch --help  等等等等

遇到的問題

Access denied

情況:我配置的用戶名密碼信息都是正確的,但是使用git的時候,死后說鑒權不通過。

解決方法:

# 重置認證信息
git config --system --unset credential.helper
# 再重新配置,windows需要使用管理員打開cmd才能執行,不然沒權限

Windows:

控制目標-用戶賬戶-管理windows憑據-z


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM