git簡單使用

2021-08-27 21:33:28 字數 1217 閱讀 8724

# 注意: 將下方的 127.0.0.1:1086或1087 更改為你自己的埠

# http和https

git config --global https.proxy

git init //初始化倉庫

git add -a //新增所有檔案到本地倉庫

git commit -m 「first commit」 //新增本次提交的描述資訊

git push -u origin master //把本地倉庫的檔案推送到遠端倉庫

關於git push推送失敗的兩種解決方案

分支是對倉庫的複製,在分支中所做的改動,不會影響到父級檔案。

大多數情況下,父級倉庫是master分支

使用checkout配合-b旗標建立乙個新分支

git checkout -b ***

列出所有分支,星號表示當前所在分支

git branch

編輯.git/config

在已經存在的ulr = ***下再新增一條url = ***

設定git使用者名稱和郵箱

git config --global user.name "yourname" git config --global user.email "[email protected]"

生成金鑰並在github中新增金鑰,確保email位址跟上方相同

ssh-keygen -t rsa -c "[email protected]"

.git/config

url = 改為 url = git@***.com/name/project.git

測試你的ssh-key

ssh -t [email protected]

git倉庫從http鏈結轉為ssh

關於git push推送失敗的兩種解決方案

git push同時推送到兩個遠端倉庫

簡單使用Git

1.登陸伺服器 git 伺服器位址 git xx.yy.zz.com.cn ssh p steven git xx.yy.zz.com.cn 密碼認證後 伺服器控制台下 cd mnt disk1 moblin kernel linux 2.6.29.y.git git branch 列出branch...

簡單使用git

1.使用郵箱到github上註冊乙個賬號 2.然後建立乙個倉庫 4.先用控制台的配置一下使用者 git config global user.name 你的使用者名字 git config global user.email 你的郵箱 5.建立ssh key 滑鼠右鍵 git gui,幫助選單 sh...

git簡單使用

從事計算機軟體開發有一段時間了,發現 管理一直是個頭痛的問題,最近花了部分時間來熟悉git這個工具,將使用經歷簡單做了哈總結.其中參閱了很多前輩的意見.1 git初始化配置 git配置主要用於標識庫username和email位址 git config global user.name you na...