关于 git 使用

使用GitHub管理代码:

1.在gitHub 上 new repositories

2.进入工程文件所在文件目录,git init

3.git add -A (进入文件 添加文件,-A表示添加全部文件)

4.git commit -m “提交备注”

5.git remote add origin url(该url是你new repositories后的url)

6.git push -u origin master (将本地的仓库提交到github账号里)(可能会输入github的账号和密码)


我按照这个步骤终端机 执行后,还是有错误啊。

error: failed to push some refs to 'https://github.com/Panda/New.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 pull --rebase origin master这句话  上传上去了,虽然上传上去了 但是不明白原因。



因为他们是两个不同的项目,要把两个不同的项目合并,git需要添加一句代码,在git pull,这句代码是在git 2.9.2版本发生的,最新的版本需要添加--allow-unrelated-histories

假如我们的源是origin,分支是master,那么我们 需要这样写git pull origin master ----allow-unrelated-histories需要知道,我们的源可以是本地的路径

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容