Github上传代码Mac
来源:互联网 发布:dikies是什么档次知乎 编辑:程序博客网 时间:2024/06/06 00:11
这篇文章写得是mac下的使用方法。
第一步:创建Github新账户
第二步:新建仓库
第三部:填写名称,简介(可选),勾选Initialize this repository with a README选项,这是自动创建REAMDE.md文件,省的你再创建。
第四步:安装Github shell程序,地址:https://desktop.github.com
第五步:打开Git Shell,输入以下命令生成密钥来验证身份
在命令行执行 ssh-keygen -t rsa生成.pub 文件
连续三个回车之后会在当前用户目录下生成.ssh文件夹,和linux一样。
没找到的话看看电脑是不是设置了显示隐藏文件
早期的OS X(10.6~10.8)系统可以使用如下两条命令来开始或者关闭系统隐藏文件的显示:
defaults write com.apple.Finder AppleShowAllFiles Yes && killall Finder //显示隐藏文件
defaults write com.apple.Finder AppleShowAllFiles No && killall Finder //不显示隐藏文件
当升级到OS X 10.9 Mavericks版本之后,这两条命令需要做一些修改,变成了如下命令:
defaults write com.apple.finder AppleShowAllFiles Yes && killall Finder //显示隐藏文件
defaults write com.apple.finder AppleShowAllFiles No && killall Finder //不显示隐藏文件
把文件夹下的id_rsa.pub文件内容全部复制。
然后打开github账户设置,如图
打开ssh keys
右上角点击add ssh key
然后在title随便输入,key栏粘贴刚才的密钥。
第六步:在Git Shell下输入命令测试刚才的公钥是否认证正确。
ssh -T git@github.com
正确结果会显示:
Warning:Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts. Hi Flowerowl! You've successfully authenticated, but GitHub does not provide shell access.
warning 不用理会。
第七步:clone刚才新建的repository 到本地,输入命令:
git clone https://github.com/Flowerowl/stumansys.git
这时会在目录下生成:
第八步:将想上传的代码目录拷贝到此文件夹下:
第九步:切换到Git shell 命令行下,输入命令:
git initgit commit -m 'init'git remote add origin https://github.com/Flowerowl/stumansys.gitgit push origin master
如果执行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 即可。
在执行git push origin master时,报错:
error:failed to push som refs to.......
则执行以下语句:
git pull origin master
先把远程服务器github上面的文件拉先来,再push 上去。
最后,你可以去项目页面查看了~~代码上传成功!
如果过程中出现 error:src refspec master does not match any 的错误是因为目录中没有文件,空目录是不能提交上去的
解决方法:
touch READMEgit add README git commit -m 'first commit'git push origin master
- Github上传代码Mac
- Mac 本地代码上传GitHub
- mac下使用github 上传代码
- mac下使用github 上传代码(转)
- mac上把代码上传至gitHub
- mac下使用github 上传代码
- github客户端上传代码 mac 注意事项
- github客户端上传代码 mac 注意事项
- github客户端怎样上传代码 mac
- mac下使用github 上传代码
- github客户端上传代码 mac 注意事项
- mac电脑下使用github上传代码
- 使用github mac客户端上传代码
- mac上传代码到Github完整
- Mac 怎样往GitHub上传代码
- github客户端上传代码 mac 注意事项
- github客户端上传代码 mac 注意事项
- mac客户端上传github
- 消除图片底部间隙的方法
- Sybase 查询死锁方法
- arguments
- EditText的一些属性
- Anroid-vlc开源播放器代码编译及简单调用手把手 以及 Ubuntu 16.04下安装VLC并解决sudo apt-get build-dep vlc失败问题
- Github上传代码Mac
- jeesite框架学习—shiro权限。
- php操作redis群集开源工具
- Python 的pytesscer 的识别功能初探
- Java Object 线程方法
- 纠结的const(static) 和 define
- 静态网站生成器(开源项目)
- Vickate_iOS_浅说NSOperationQueue、GCD、NSThread
- 1004. 成绩排名 (20)