第一次用Github desktop(mac)提交代码遇到的问题


1.新建代码仓库

 

2.生成密钥

ssh-keygen -C 'your@email.address' -t rsa

3.到根目录下的.ssh文件夹下找到id_rsa.pub文件,将里面的内容复制到下图所标的位置

 

4.在Git shell下输入ssh -T git@github.com测试刚才上传的公钥是否正确

正确时会显示:

Hi "Your Name"! You've successfully authenticated, but GitHub does not provide shell access.

 

5.赋值刚创建的代码仓库的地址,把仓库内容clone到本地

git clone https://github.com/YangXudongJack/JYMenuview.git

 

6.这样就把代码clone到了本地,然后找到仓库文件,把要提交的代码文件copy到里面

 

7.切到Git shell下输入命令

git init

git commit -m 'JYMenuview'

git remote add origin https://github.com/YangXudongJack/JYMenuview.git

git push origin master

 

 

(1)如果执行git commit -m 'JYMenuview'报错提示

On branch master

Your branch is up-to-date with 'origin/master'.

Untracked files:

JYMenuview.xcodeproj/

JYMenuview/

JYMenuviewTests/

JYMenuviewUITests/

nothing added to commit but untracked files present

则执行git add jymenuview.xcodeproj/,把提示的文件都加入到仓库的管理目录下

 

(2)如果执行git remote add origin

https://github.com/Flowerowl/stumansys.git

,出现错误:

  fatal: remote origin already exists

则执行以下语句:

  git remote rm origin

再往后执行git remote add origin https://github.com/Flowerowl/stumansys.git 即可。

 

(3)在执行git push origin master时,报错:

  error:failed to push som refs to.......

则执行以下语句:

  git pull origin master

先把远程服务器github上面的文件拉下来,再push 上去。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM