使用Git远程仓库管理代码

1- 打开OSchina.net
点击新建项目—> 选择语言—>添加 .gitignore ( swift的.gitignore文件在OSChina中目前没有,可以手动创建添加.gitignore文件) —> 私有 —>创建 —>选择https 协议,点击复制链接  https://git.oschina.net/CoderSUX/WB.git

2- 打开终端
cd 切换到要写代码的目录  cd /Users/suxiang/Desktop/06-swift项目
git clone 刚才复制的网址  https://git.oschina.net/CoderSUX/WB.git 
net/CoderSUX/WB.git
Cloning into 'WB'...
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
Checking connectivity... done.
suxiang:06-swift项目 suxiang$ 

上面的提示是正确的完成 clone
添加 .gitignore 文件
git add  .
git commit  -m “注释"
git push

3- 打开Xcode
创建项目代码, 要保存到刚才 cd 进入的那个目录 /Users/suxiang/Desktop/06-swift项目
选择Source Control —>点击commit (或者用快捷键 command + option + c)  —>写上注释 —>勾选 Push to remote —>commitFile










swift.gitignore配置内容

.DS_Store
   
  # Standard .gitignore file for Ruby on Rails from github.com
  # Xcode
  #
  # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
   
  ## Build generated
  build/
  DerivedData/
   
  ## Various settings
  *.pbxuser
  !default.pbxuser
  *.mode1v3
  !default.mode1v3
  *.mode2v3
  !default.mode2v3
  *.perspectivev3
  !default.perspectivev3
  xcuserdata/
   
  ## Other
  *.moved-aside
  *.xcuserstate
   
  ## Obj-C/Swift specific
  *.hmap
  *.ipa
   
  ## Playgrounds
  timeline.xctimeline
  playground.xcworkspace
   
  # Swift Package Manager
  #
  # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
  # Packages/
  .build/
   
  # CocoaPods
  #
  # We recommend against adding the Pods directory to your .gitignore. However
  # you should judge for yourself, the pros and cons are mentioned at:
  # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
  #
  Pods/
   
  # Carthage
  #
  # Add this line if you want to avoid checking in source code from Carthage dependencies.
  # Carthage/Checkouts
   
  Carthage/Build
   
  # fastlane
  #
  # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
  # screenshots whenever they are needed.
  # For more information about the recommended setup visit:
  # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
   
  fastlane/report.xml
  fastlane/Preview.html
  fastlane/screenshots
  fastlane/test_output

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值