上传Xcode代码到Github(本文全部基于命令行)
来源:互联网 发布:生命数组 编辑:程序博客网 时间:2024/05/19 02:29
上传Xcode代码到Github(本文全部基于命令行)
1.新建Xcode工程(GitUploadTest)
建议:初学者应新建工程,然后再按本文所述一步一步来。
注意:有很多网友通过下面的联系方式找到我,为我为什么不好使,有一部分的原因是由于没有配置SSH,本文中尚未提及,我的博客中有一篇关于如何生成SSH的介绍,但不够详尽,有机会我会将其补充完整。
2.切换到工程目录
$cd .../GitUploadTest
3.初始化代码仓库
$git init
4.添加文件到仓库的缓存区(从工作目录添加到缓存区)。
在此之前需要做的是添加gitignore文件,如果不添加的话会在将来的开发使用中造成很多不必要的错误。添加方法也很简单,在Github上下载对应的gitignore文件,此处对应的是Objective-C.gitignore。下载完成后把文件放到对应的工程目录根目录下,并将文件名删除。
在此之前我们可以先看看文件的状态:
$git statusOn branch masterInitial commitUntracked files: (use "git add <file>..." to include in what will be committed) .gitignore GitUploadTest.xcodeproj/ GitUploadTest/ GitUploadTestTests/ GitUploadTestUITests/
Untracked files:表示下面所显示的文件都没有添加到git,git无法对其进行跟踪。
下面就把上面的Untracked files add 到git的版本管理中。
$ git add .$ git status On branch masterInitial commitChanges to be committed: (use "git rm --cached <file>..." to unstage) new file: .gitignore new file: GitUploadTest.xcodeproj/project.pbxproj new file: GitUploadTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file: GitUploadTest/AppDelegate.swift new file: GitUploadTest/Assets.xcassets/AppIcon.appiconset/Contents.json new file: GitUploadTest/Base.lproj/LaunchScreen.storyboard new file: GitUploadTest/Base.lproj/Main.storyboard new file: GitUploadTest/Info.plist new file: GitUploadTest/ViewController.swift new file: GitUploadTestTests/GitUploadTestTests.swift new file: GitUploadTestTests/Info.plist new file: GitUploadTestUITests/GitUploadTestUITests.swift new file: GitUploadTestUITests/Info.plist
“git add .”表示把当前目录下的所有文件,文件夹及文件夹中的子文件,以此类推,简单点说,也就是把当前目录下的所有文件都纳入git的管理中。
5.将所做的更改从缓存区提交到HEAD
$git commit -m "init project"[master (root-commit) 4c7691a] init project 13 files changed, 875 insertions(+) create mode 100644 .gitignore create mode 100644 GitUploadTest.xcodeproj/project.pbxproj create mode 100644 GitUploadTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 GitUploadTest/AppDelegate.swift create mode 100644 GitUploadTest/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 GitUploadTest/Base.lproj/LaunchScreen.storyboard create mode 100644 GitUploadTest/Base.lproj/Main.storyboard create mode 100644 GitUploadTest/Info.plist create mode 100644 GitUploadTest/ViewController.swift create mode 100644 GitUploadTestTests/GitUploadTestTests.swift create mode 100644 GitUploadTestTests/Info.plist create mode 100644 GitUploadTestUITests/GitUploadTestUITests.swift create mode 100644 GitUploadTestUITests/Info.plist$git statusOn branch masternothing to commit, working directory clean
此时我们已经把所做的更改从缓存区提交到了HEAD。
6.创建Github仓库
StepOne:
在浏览器中输入https://github.com/wdxgtsh?tab=repositories,点击右上角的New,如图所示:StepTwo:输入Repositories name:GitUploadTest ;再输入Description(可选): GitUploadTest; 选择Public repository,Private repository需要付费。如图所示:
StepThree:点击Create repository,就创建好仓库了。获取到SSH:git@github.com:wdxgtsh/GitUploadTest.git。结果如图所示:
7.在git中创建主干线
在git中创建主干线有两种方式,一种是SSH方式,需要配置SSH,在这里就不再赘述,不知道怎么配置的可以自行谷歌。另外一种是https,此法比较繁琐。再次也不予介绍(需要多次输入账户和密码)。
$git remote add origin git@github.com:wdxgtsh/GitUploadTest.git
8.将本地的项目push到Github上。
$git push origin master
此时,查看Github上的仓库。如下所示:
9.将Github上的代码更新到本地
$git pull origin master
注:以上所有在命令行中输入的命令都是在XCode项目的根目录下。
- QQ:729376398
- QQ群:541862523
欢迎大家一起交流,not just 技术!!!嘿嘿…….
- 上传Xcode代码到Github(本文全部基于命令行)
- xcode代码上传到Github上
- Xcode本地代码上传到Github
- 使用命令行上传代码到github
- xcode中配置git并上传代码到github
- 如何将本地Xcode代码上传到GitHub上
- 使用git命令行上传代码到github中
- 如何用git命令行上传本地代码到github
- 如何用git命令行上传本地代码到github
- 终端命令行上传代码到GitHub的步骤
- Git bash命令行上传本地代码到github
- 终端命令行上传代码到GitHub的步骤
- MacOS使用命令行上传本地代码包到Github方法
- iOS-使用命令行实现将本地代码上传到GitHub
- xcode上传代码至GitHub
- 上传代码到github
- 上传代码到Github
- 上传代码到github
- ColorArcProgressBar——实现QQ健康步数显示、仪表盘效果
- HDU 4607 Park Visit(树的直径)
- 回文串判断与查找
- iOS 越狱恢复(平刷而不是升级)
- [ZOJ 3469]Food Delivery[记忆化搜索]
- 上传Xcode代码到Github(本文全部基于命令行)
- VC++6.0调用Web Services(转)
- 动画研究二
- MFC学习笔记之四(音乐,文字输出,障碍物,弹窗)
- JSP:表单开发【结合session】
- 动态生成的html中无法使用jquery事件的解决方法
- android imageView 获取指定名字的图片、从MyEclipse服务器下载图片
- 设计模式——单例模式(1)
- gdb调试问题记录