你的位置:首页 > 信息动态 > 新闻中心
信息动态
联系我们

将本地仓代码提交到远程仓库

2021/12/13 15:41:01

清空git缓存,否则.gitignore的改变无效

git rm -r --cached .

git add .

git commit -m 'update .gitignore'

1、(先进入项目文件夹)通过命令 git init 把这个目录变成git可以管理的仓库

git init

2、把文件添加到版本库中,使用命令 git add .添加到暂存区里面去,意为添加文件夹下的所有文件

git add .    --小数点和add之间有个空格

3、用命令 git commit告诉Git,把文件提交到仓库

git commit -m "first commit"  --引号内为提交说明

4、关联到远程库

git remote add origin 你的远程库地址

5、获取远程库与本地同步合并(如果远程库不为空必须做这一步,否则后面的提交会失败)

git pull --rebase origin master

6、把本地库的内容推送到远程

git push -u origin master

*、状态查询命令

git status

克隆项目

 git clone <项目地址>

    如:git clone https://github.com/xxx/blog.git

查看所有分支

git branch -a 

切换分支

git checkout 分支名