在gitlab新建空项目,将本地的git仓库的内容上传
gitlab新建了这个项目。
按照官网的步骤上传代码
一:将本地代码上传到本地仓库
1.进入项目文件夹
git init
2.项目代码添加到本地git
git add .
3.提交到stage区域
git commit -m "这次同步的内容"
二:本地仓库连接远程gitlab地址
1.连接gitlab的项目地址
git remote add origin https://gitlab.com/xxxxxx/xxxxxx.git
2.上传本地代码
git push -u origin --all
3.如果打了tag,上传tag
git push -u origin --tags
———————————————————设置———————————————————————————
1.安装之后设置用户名和邮箱
git config --global user.name "xxx"
git config --global user.email "xxx"
————————————————————ssh——————————————————————
[root@iZwz94d6ox6sdexe984lpuZ ~]# git config --global user.name "yindongzi"
[root@iZwz94d6ox6sdexe984lpuZ ~]# git config --global user.email "350343754@qq.com"
[root@iZwz94d6ox6sdexe984lpuZ ~]# cd /root/.ssh
[root@iZwz94d6ox6sdexe984lpuZ .ssh]# cat id_rsa.pub
ssh-rsa ……………………
生成密钥对:
ssh-keygen -t rsa -C "350343754@qq.com"
复制公钥的内容,粘贴到github。
然后在pc端登陆github
[root@iZwz94d6ox6sdexe984lpuZ .ssh]# ssh git@github.com
The authenticity of host 'github.com (13.250.177.223)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
RSA key fingerprint is MD5:16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,13.250.177.223' (RSA) to the list of known hosts.
PTY allocation request failed on channel 0
Hi ZhzhIn! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
——————————————命令————————
---git文件流:workspace-stage-master git status
#git checkout -xxx 撤销工作区的修改
git diff
#修改内容: 工作区修改 git add (临时仓库-stage)
#git reset 撤销临时仓库的修改
git status git commit(提交到仓库-master)
#git reset --hard HEAD^ 返回上一版本,^个数代表上几个存档
git push () git log
git push 推到对应的服务器(添加了ssh公钥的服务器)
—————————————rebase———————————
合并status中的代码记录
git rebase -i (对应代码版本的id)
git branch dev#创建分支
git checkout dev#切换分支
git merge dev#把分支合入master ,当前处于master时才能合入其他分支
_______________git remote_____________
git remote add originName xxxx.git 加载远程仓库的代码到本地
git branch 查看当前用户的branch
git branch -a 查看该项目的branch
git pull 把远程的master代码拉下来
# 处理冲突
git commit -a -m "fix"
git checkout master 切换到master分支
git merge remote/originName/HEAD 合并分支 git push 传到自己的远程仓库,github可以看到修改
git status 检查一下
————————常规操作——————————
git remote add other xxx.git
git fetch other master
git merge remote/other/master
git commit -a -m
在gitlab新建空项目,将本地的git仓库的内容上传的更多相关文章
- 【IDEA】本地新建Maven项目+配置Git和GitHub+代码上传和拉取到GitHub+其他IDEA和GitHub实战
一.本地新建Maven项目并启动成功 1. 按照IDEA提供的模板,构建一个maven webapp的模板项目. 一路Next,到最后的finish.如下图. 2. 新建Tomcat,启动刚建立的项目 ...
- 本地项目关联到远程git仓库
本地项目关联到远程git仓库 场景是这样的:在gitee-code上新建一个项目,gitee会帮你把项目初始化,初始化之后会根据你的选择生成默认的说明文件和gitignore文件.这个时候你就可以复制 ...
- 通过git shell 在Github上传本地项目
首先现在github上新建一个库,再进行如下操作,过程不赘述 1.打开git shell 2.cd到项目位置 // cd archives-vue 3.git init 4.Get add ...
- [New Portal]Windows Azure Virtual Machine (14) 在本地制作数据文件VHD并上传至Azure(1)
<Windows Azure Platform 系列文章目录> 之前的内容里,我介绍了如何将本地的Server 2012中文版 VHD上传至Windows Azure,并创建基于该Serv ...
- wepy开发小程序 大坑....本地调试ok,小程序上传体验版 组件出现问题
如果你碰到的上述问题(本地调试ok,小程序上传体验版 各种莫名其妙的问题-卡死-组件属性失效-$apply()不起作用) 您需要关闭 微信开发者工具中: 1.微信开发者工具-->项目--> ...
- 学习Git的一点心得以及如何把本地修改、删除的代码上传到github中
一:学习Github的资料如下:https://git.oschina.net/progit/ 这是一个学习Git的中文网站,如果诸位能够静下心来阅读,不要求阅读太多,只需要阅读前三章,就可以掌握Gi ...
- 项目总结21:项目总结21:input实现多图上传(FormData)(上传OSS并保存数据库)
项目总结21:input实现多图上传(FormData)(上传OSS并保存数据库) 备注:本案例,作为Demo,包含少量的项目业务逻辑,input多图上传的逻辑是完整的: 不废话直接上代码 1-前端标 ...
- 本地创建 Git 仓库并关联 Phabricator
前提条件: 1.熟悉 Git 操作. 2.在搭建好的 Phabricator 上已注册账号,并开通相关权限. 方法一: 1.在本地创建Git仓库. 2.ssh-keygen -t rsa生产公钥私钥, ...
- Android 本地tomcat服务器接收处理手机上传的数据之案例演示
上一篇:Android 本地tomcat服务器接收处理手机上传的数据之环境搭建 本篇基于上一篇搭建的服务器端环境,具体介绍Android真机上传数据到tomcat服务器的交互过程 场景:A ...
随机推荐
- 常用Mac快捷键
1.复制Cmd + C 粘贴Cmd + C —-> Cmd + V 剪切Cmd + C —-> Cmd + Opt + V 2.查看隐藏文件 Cmd + shift + . 3. 货币符号 ...
- python之读取和写入csv文件
写入csv文件源码: #输出数据写入CSV文件 import csv data = [ ("Mike", "male", 24), ("Lee&quo ...
- vue自定义组件及传值
1.使用 Vue.component() 方法注册组件 2.使用 props 属性传递参数 v-for="item in items": 遍历 Vue 实例中定义的名为 items ...
- hdu-1251(字典树)
字典树模板题. ps:数组要开大,40w左右才行,不然疯狂re 代码: #include<iostream> #include<algorithm> #include<c ...
- Ubuntu18.04下安装Sublime Text3!
这几天安装了Ubuntu18.04,然后在里面安装Sublime Text3,结果各种问题!各种BUG!试了网上各种办法!尼玛!都是坑爹的啊! 最后还是楼主自己解决了…… 废话不多说,直接按顺序执行下 ...
- 转 Debugging AutoCAD 2017 using Visual Studio 2015
原文地址: http://adndevblog.typepad.com/autocad/2016/05/debugging-autocad-2017-using-visual-studio-2015. ...
- River Problem HDU - 3947(公式建边)
River Problem Time Limit: 6000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Tot ...
- 「BZOJ1251」序列终结者 (splay 区间操作)
题面: 1251: 序列终结者 Time Limit: 20 Sec Memory Limit: 162 MBSubmit: 5367 Solved: 2323[Submit][Status][D ...
- QML用Qt.labs.settings实现保存用户设置
举个简单的例子: main.cpp中设置程序信息 QGuiApplication::setApplicationName("Gallery"); QGuiApplication:: ...
- 【CF833D】Red-Black Cobweb(点分治)
[CF833D]Red-Black Cobweb(点分治) 题面 CF 有一棵树,每条边有一个颜色(黑白)和一个权值,定义一条路径是好的,当且仅当这条路径上所有边的黑白颜色个数a,b满足2min(a, ...