github建立仓库、上传、更新
来源:互联网 发布:云计算p层 编辑:程序博客网 时间:2024/05/29 04:41
建立仓库
下载git:
地址:git
按提示安装即可,不多做介绍。安装完成后在文件夹下点击右键会出来Git Bash Here,点击打开。
输入命令 git init在本地建立一个仓库,
新建任意一个文件,在git bash here中输入命令 git status查看文件状态
相比于svn不同的地方就是git有一个暂存区的概念,输入命令git add * 或git add {文件名}就是再往版本库中添加文件,
往版本库中添加文件时先是把文件添加到了暂存区,在输入命令git commit -m {文字介绍或修改注释},才会把暂存区的内容提交到当前分支master(创建git版本库时会自动创建一个唯一分支master)
git init -> 新建文件 ->git status -> git add * 或 git add 文件名 ->git commit -m 修改注释
关联本地仓库
登陆github,建立一个新的远程仓库,并复制仓库地址
在本地仓库中打开git bash here,输入命令git remote add origin 远程仓库地址,origin即为远程仓库名称,这是git默认的叫法
输入命令git push -u origin master,把前面已经新建好并提交的文件可以上传到远程库中,可以刷新网页查看
SSH警告
第一次使用git的clone或push命令链接github时,会得到一个警告
The authenticity of host 'github.com (xx.xx.xx.xx)' can't be established.
RSA key fingerprint is xx.xx.xx.xx.xx.
Are you sure you want to continue connecting (yes/no)?输入yes即可
关于SSH key
在用户目录下有一个.ssh目录,里面有id_rsa和id_rsa.pub俩个文件,这俩个就是SSH Key的密钥对
如果没有这俩个文件打开git bash输入命令ssh-keygen -t rsa -C “你的邮箱地址”,就会生成密钥对
登陆github,打开设置,点击选项SSH and GPG keys,add new SSH Key,title随便起个名字,再把id_rsa.pub中的内容粘贴到Key中,点击Add SSh key。
关于bug
$ git push -u origin master
To git@github.com:fansining/vueBox.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:fansining/vueBox.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
看见这个输入命令 $ git push origin master -f
- github建立仓库、上传、更新
- github视频教程-02 建立项目仓库以及代码上传
- github建立本地仓库
- github建立远程仓库
- 上传和更新本地文件到GitHub远程仓库
- git建立本地仓库、gitHub上传项目以及git和gitHub的关系
- Git建立github远程仓库
- 建立github本地仓库与远程仓库
- 【github】上传本地代码仓库
- Github创建仓库上传代码
- 本地文件上传到github仓库
- 本地仓库上传到github
- 上传代码到github仓库
- github—本地建立与远端仓库的联系以及代码上传与合并
- GitHub仓库的建立和删除
- GitHub之URL方式建立仓库
- Github的简单使用代码托管(建立自己的仓库实现代码的上传与版本管理)
- git从本地仓库上传到github
- 解决页面有EditText时,软键盘自动弹出
- 机器学习卷积与池化
- Sklearn安装
- 【数据库】3数据类型、运算符
- OK Log设计思路
- github建立仓库、上传、更新
- JAVA WEB工程中的web.xml文件
- Delphi中ActionList及Action使用
- 【Oracle】Oracle中chr()的含义
- require中exports和module.exports
- redux介绍 1
- 我的第一篇
- Android 编译命令
- php类和对象: clone 克隆