配置git
打开 git bash 开始配置
配置用户名(提交时候会引用)
git config --global user.name "wlj"
配置邮箱
git config --global user.email "xxxx@qq.com"
让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 "xxxx@xx.com"
一直按回车(Enter),不要输入任何密码之类,生成 ssh key pair
cat ~/.ssh/id_rsa.pub
显示很长的公匙,请复制出来
将公匙加到码云上
这样既可使用SSH的方式对码云上的项目使用Git了。
克隆
git clone git@gitee.com: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