git 推送基本操作
来源:互联网 发布:投弹兵升级数据 编辑:程序博客网 时间:2024/05/17 03:01
本文介绍使用命令行创建远程仓库,编写本地文件,添加 .gitignore 文件,并提交到远程仓库:
# 使用命令行创建 git 的远程仓库curl -u 'degawong' https://api.github.com/user/repos -d '{"name":"my-repos"}'
在大括号内的 { 参数:数值 } 对中参数有很多,都可以手动设置:
# 官网给出的参数解释如下所示 :{ "name": "degawong", "description": "This is your first repository", "homepage": "https://github.com", "private": false, "has_issues": true, "has_projects": true, "has_wiki": true}# 一般使用时,可以只使用上述几个参数,还有其他的无关紧要的参数可以选择默认# 官网给的例子中, "private" 属性选择了私有,这个是需要缴费的,所以这个参数# 需要修改为 false
此时,在 github 上就生成了名字为 my-repos 得远程仓库:
# 新建目录 my-reposmkdir my-repos# 进入到 my-repos 目录cd my-repos# 初始化 git 仓库git init # 添加远程仓库连接git remote add origin https://github.com/degawong/my-repos.git# 编写一个项目(opencv)……# 添加 .gitignore 文件touch .gitignore# 编写 .gitignore 文件 去除自动生成得文件夹与中间文件等vi .gitignore# 添加本目录下的所有文件git add .# 提交添加的所有文件git commit -m"it's a curl repos solution"# 提交到远程仓库(首次提交添加 -u)git push -u origin master
# 断开当前的远程 repos 连接git remote rm <name of repos>git add origin master <name of repos># 还有这种方式也可以git remote set-url origin url
还有,要注意的是,建立的 git repos 名称有两种命名方式:
# 分别为 ssh 与 https 方式,根据个人爱好使用git@github.com/degawong/my-repos.githttps://github.com/degawong/my-repos.git
我的一个使用命令行窗口建立的远程 repos 的项目链接为 :
https://github.com/degawong/curl-repos
0 0
- git 推送基本操作
- (九)Git 推送操作
- Git基本操作
- Git 基本操作
- git基本操作
- git基本操作
- git基本操作
- git分支基本操作
- git基本操作介绍
- Git的基本操作
- Git操作基本命令
- git的基本操作
- Git 基本操作
- Git基本命令行操作
- git remote 基本操作
- git 基本操作
- git基本操作
- git基本操作
- 详解:智能医学影像分析的前沿与挑战
- 在mybatis中动态创建数据表
- 我的java学习之路-基础-DOM4J
- Java序列化
- Git 提示fatal: remote origin already exists 错误解决办法
- git 推送基本操作
- PHP之0与空字符串关系测试以及详解
- 数据结构——栈和队列
- ubuntu rar
- web开发-本地Windows远程桌面连接阿里云Ubuntu服务器-学习笔记九
- Linux系统开机自动加载驱动module
- 百度地图、高德地图都用POI吸引你,不过它到底是什么?
- bzoj 4819: [Sdoi2017]新生舞会 二分答案+费用流
- 我的java学习之路-html、css学习