每天码代码打卡任务,老师需要我们提交链接,这就需要我们把自己打的代码文件上传到GitHub上来,以此获得链接。
自己是一个新人,安装git也是什么都不懂(跟着网上的教程也总是能出错)
安装正常操作:https://www.cnblogs.com/sdcs/p/8270029.html
然而第一次安装中间出现不少问题,主要还是因为自己不知道要输的代码的含义,导致自己搞了个文件夹也关联好了但是就是没法把文件上传
第二次将git的repository关联到本地文件夹后,却再次没法上传file
问题如下
[email protected] MINGW64 /d/123 (master)
$ git push origin master
To https://github.com/Sisterben/-.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to ‘https://github.com/Sisterben/-.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.
解决方案:https://blog.csdn.net/qq_29985391/article/details/85047841
现在终于将自己的代码上传上去了!
但是下一次操作还是会出现上面的问题,要多输一次代码,先将远程仓库的内容合并到本地,然后再上传。求解。
平时需要的操作:
1.将自己的文件拖到本地文件夹
2.git add 文件
3.git commit -m“备注”
原文地址:https://www.cnblogs.com/sisterben/p/11615876.html