使用Git远程仓库管理代码

来源:互联网 发布:骨朵网络剧 编辑:程序博客网 时间:2024/05/01 06:47
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

0 0
原创粉丝点击