git的基本使用

2021-08-14 13:00:17 字數 1086 閱讀 1589

sudo add-apt-repository ppa:git-core/ppa

sudo apt-get update

sudo apt-get install git

git --version
配置git
git config --global user.name "your name"

git config --global user.email "email address"

檢視配置
git config --list
建立本地倉庫
git init localrepo
然後進入到倉庫路徑下

新增檔案

可以新建也可以複製過來,如test.cpp

git add test.cpp
提交

提交資訊自己定義,-m後面必須有這個引數

git commit -m "create a git project"
提交到github
git remote add origin 自己的github中的乙個repository的url,格式是http://****.git

git push origin master

第二次在同乙個github的repository中提交新檔案的時候不需要git remote add origin

git linux 配置自動補全

首先,拷貝 到~/.git-completion.bash

其次

sudo vim ~/.bashrc

新增if [ -f ~/.git-completion.bash ]; then

. ~/.git-completion.bash

fi然後

source ~/.bashrc

git mac 配置自動補全

git 密碼快取

git config credential.helper store

Git的基本使用

一 準備工作 1.建立庫資料夾 repository 使用者資料夾 develop 2.cd c cd software 清屏 ctrl l 或clear cd repository 然後初始化倉庫 git init bare shared.git 在develop資料夾下建立兩個使用者 user1...

git的基本使用

1 遠端倉庫相關命令 檢出倉庫 git clone git 檢視遠端倉庫 git remote v 新增遠端倉庫 git remote add name url 刪除遠端倉庫 git remote rm name 拉取遠端倉庫 git pull remotename localbranchname ...

git的基本使用

date 2015 12 26 updated 2016 01 10 git是 管理工具,方便開發者之間的協作。現在在各個開發平台上都已經出現了git的視覺化管理客戶端,然而對於通過shell命令對 庫進行管理永遠比視覺化介面上操作來得穩妥,下面根據自身使用經驗,就git的使用規範以及常見命令做入門...