简单五步把自己的项目push到GitHub

18.11.7更新

  • branch master -> FETCH_HEAD
    fatal: refusing to merge unrelated histories
git pull origin master --allow-unrelated-histories

18.5.11更新

报错

To https://github.com/Tate-zwt/WTMicroblog.git
! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/Tate-zwt/WTMicroblog.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

18.5.3更新

中断终端的操作

cmd + .
1.登录到github上创建一个project(名字和pod库的名字要一致)
2.本地创建一个pod lib库 :pod lib create 你设定的名字
3.写好podspec之后 cd到该文件夹
4.git init
5.git add .
6.git commit -m "你的注释"
7.git remote add origin 你的url
8.git push -u origin master
9.git tag 0.1.0
10.git push origin --tags
11.pod trunk push 你设定的名字

可能遇到的问题

[!] Authentication token is invalid or unverified. Either verify it with the email that was sent or register a new session.
简单五步把自己的项目push到GitHub_第1张图片
image.png

需要你设定一个接受邮件的邮箱用于接受验证邮件

18.4.14更新

提交代码遇到错误

$ git push origin master
To [email protected]:qzmly100/repository-.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to '[email protected]: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 origin master -f,强行让本地分支覆盖远程分支

把自己的项目上传到github步骤

0.cd 你项目的路径
1.git init
2.git add .
3.git commit -m "注释语句"
4.git remote add origin https://自己的仓库url地址
5.git push -u origin master

把项目上传到github上可能遇到的问题

1.fatal: remote origin already exists.

解决办法如下:
git remote rm origin 
继续第四步,第五步

2.git error “unable to write sha1 filename … Permission denied”

HTTPS改成SSH

3.利用Xcode把代码提交到github失败“A commit message is required to perform this operation.Enter a commit message and try again.

需要你写一下你确认提交的信息,就是你这次提交上去修改了什么功能,简单描述一下.

你可能感兴趣的:(简单五步把自己的项目push到GitHub)