Git简单使用

2019-06-14  本文已影响0人  李荣喜

使用Git时遇到的问题

1、git init
2、git add .   //"."点代表所有文件
3、git commit -m '注释语句(修改说明)'
4、git remote add origin https://自己要上传到的仓库地址
5、git pull origin master 
6、git push -u origin master 

上传时遇到的报错信息

failed to push some refs to 'https://github.com/mantou811/demo.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.

解决方法:

1、强制push(首次上传可用,后期上传需谨慎)

$ git push -u origin master -f

*这样会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候。

上一篇 下一篇

猜你喜欢

热点阅读