1.cd 你项目的路径
2.git init
3.git add .
4.git commit -m "注释语句"
5.git remote add origin https://自己在github创建的仓库url地址
6.git push -u origin master
把项目上传到github上可能遇到的问题
1.fatal: remote origin already exists.
解决办法如下:
git remote rm origin
继续第五步,第六步
- push代码遇到错误
$ git push origin master
To git@github.com:qzmly100/repository-.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:qzmly100/repository-.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 -f origin master 强行让本地分支覆盖远程分支
3.git error “unable to write sha1 filename … Permission denied”
HTTPS改成SSH
4.利用Xcode把代码提交到github失败“A commit message is required to perform this operation.Enter a commit message and try again.
需要你写一下你确认提交的信息,就是你这次提交上去修改了什么功能,简单描述一下.
网友评论