Git 配置到碼雲 +基本命令總結

配置git 

打開 git bash 開始配置

配置用戶名(提交時候會引用)

git config --global user.name "wlj"   

配置郵箱

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

讓Git不要管Windows/Unix換行符轉換的事

git config --global core.autocrlf false

避免git gui中的中文亂碼

git config --global gui.encoding utf-8

避免git status顯示的中文名亂碼

git config --global core.quotepath off

windows區分大小寫設置

 git config --global core.ignorecase false


生成ssh

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

一直按回車(Enter),不要輸入任何密碼之類,生成 ssh key pair

ssh-add ~/.ssh/id_rsa

如果出現 Could not open a connection to your authentiacation agent

說明執行成功了 ,已經添加了私匙。

cat ~/.ssh/id_rsa.pub

顯示很長的公匙,請複製出來

將公匙加到碼雲上

 

這樣既可使用SSH的方式對碼雲上的項目使用Git了。

 

克隆

git clone [email protected]:lian_jie/loveme.git 

拉取

Git pull 

添加文件

Git add ./ 

提交

Git commit -m "haha~ ha~ "

推送

Git push

看日誌

git log

 

首次push 項目需要remote 

cd existing-project
git init
git add --all
git commit -m "Initial Commit"
git remote add origin https://XXXXXXXXXXX
git push -u origin master

 

一、 切換到被copy的分支(master),並且從遠端拉取最新版本

$git checkout master
$git pull

二、從當前分支拉copy開發分支

$git checkout -b dev
Switched to a new branch 'dev'

三、 把新建的分支push到遠端

$git push origin dev

四、拉取遠端分支

$git pull

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=origin/<branch> dev

經過驗證,當前的分支並沒有和本地分支關聯,根據提示進行下一步:

五、關聯

$git branch --set-upstream-to=origin/dev

參考文章 :

https://blog.csdn.net/u010920327/article/details/78741947

https://www.jianshu.com/p/93318220cdce

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章