git程式碼託管操作
阿新 • • 發佈:2019-03-03
安裝git工具
第一次提交步驟過程
建立倉庫:如"scripts"
https://github.com/www-attacker-club/scripts
#新建後的git專案地址
配置全域性資訊
git bash
命令列下:
git config --global user.name "Logos" git config --global user.email "[email protected]" #配置個人資訊
git config -l #檢視資訊
git init
#在當前目錄新建一個Git程式碼庫
git add .
#將專案的所有檔案新增到暫存區
- git add -A 提交所有變化
- git add -u 提交被修改(modified)和被刪除(deleted)檔案,不包括新檔案(new)
- git add . 提交新檔案(new)和被修改(modified)檔案,不包括被刪除(deleted)檔案
git commit -m "更新檔案"
#提交更新到本地倉庫
git remote add origin https://github.com/www-attacker-club/scripts #將本地的倉庫關聯到github上(shell是我新建的專案)
git pull origin master
#先pull GitHub保持檔案統一
pull失敗執行git pull origin master --allow-unrelated-histories
git push -u origin master
#上傳程式碼到遠端庫(輸入github賬號密碼)
key 登入
windows主機ssh登入
本地生產金鑰對,將公鑰上傳至gitlab ###新增一個key公鑰
github 建立倉庫提示操作
…or create a new repository on the command line
echo "# GUI" >> README.md git init git add README.md git commit -m "first commit" git remote add origin [email protected]:L00J/GUI.git git push -u origin master
…or push an existing repository from the command line
git remote add origin [email protected]:L00J/GUI.git
git push -u origin master
更改遠端的URL
git remote -v
#檢視遠端倉庫
git remote set-url origin [email protected]:USERNAME/REPOSITORY.git
#更改遠端的URL
git remote set-url origin https://github.com/L00J/scripts
#更改遠端的URL例項
gitlab 操作提示
Git global setup
git config --global user.name "guest"
git config --global user.email "[email protected]"
Create a new repository
git clone [email protected]:jingjing/zabbix.git
cd zabbix
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
Existing folder
cd existing_folder
git init
git remote add origin [email protected]:jingjing/zabbix.git
git add .
git commit -m "Initial commit"
git push -u origin master
Existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin [email protected]:jingjing/zabbix.git
git push -u origin --all
git push -u or