要查看当前配置有哪些远程仓库,能够用 git remote 命令git
电脑新安装 git 配置步骤github
一、给本身起个名字 配置 用户名 邮箱
git config --global user.name "su_king"
git config --global user.email "su_king@163.com"缓存
二、生成密匙 上传到 本身的远程服务器 (密匙默认在当前用户下 .ssh 文件夹)
ssh-keygen -t rsa -C "su_king@163.com" 服务器
三、clone 项目到本地
git clone git@gitee.com:sukcore/sukcore.gitssh
四、接下来本地操做了 关联远程仓库
git remote add gitee git@gitee.com:sukcore/sukcore.gitrem
用git remote -v查看远程库信息
能够删除已有的 远程库
git remote rm giteeit
第一步,用命令git add告诉Git,把文件添加到仓库:
git add readme.txtast
添加全部文件 git add . test
删除文件
执行 $ git rm * -r(记得,cd 到你要删除的目录下。固然 * 能够换成指定目录)email
第二步,用命令git commit告诉Git,把文件提交到仓库:
git commit -m "本次提交的说明"
五、推送本地修改到远程服务器
git push gitee master
注意clone 必须 拥有本身的帐号 而且上传过 ssh key 码云 or github
6. .gitignore 文件配置 要忽略的 文件 不提交
一、忽略文件
*.bak # 忽略全部扩展名为.bak的文件
!keep.bak # 但keep.bak文件除外(不会被忽略)
temp/test.txt # 忽略temp目录下的test.txt文件
temp/*.txt # 忽略temp目录下全部扩展名为.txt的文件
二、忽略目录
temp/ # 忽略temp目录下的全部目录和文件
temp/*/ # 忽略temp目录下的全部目录,但不会忽略该目录下的文件
三、加入gitignore文件没有起做用怎么办
先把本地缓存删除 在Git根文件夹下运行如下的Git命令:git rm -r --cached .git add .git commit -m 'update .gitignore'