osChina终端命令上传代码

//首先看一下自己是否有公钥,在 我的资料-->SSH公钥  查看,如果没有,添加自己的SSH 公钥:

//SSH Key 可以让你在你的电脑和 Git @ OSC 之间建立安全的加密连接

$ ssh -T [email protected]

//若返回
Welcome to Git@OSC, zb_j!

//则说明添加SSH公钥成功

boyatekiMacBook-Pro-2:weibo zbj$ git config --global user.name "zb_j"
boyatekiMacBook-Pro-2:weibo zbj$ git config --global user.email "[email protected]"
boyatekiMacBook-Pro-2:weibo zbj$ git init
Initialized empty Git repository in /Users/zbj/项目/osChina/weibo/.git/
boyatekiMacBook-Pro-2:weibo zbj$ touch README.md
boyatekiMacBook-Pro-2:weibo zbj$ git add README.md
boyatekiMacBook-Pro-2:weibo zbj$ git commit -m "first commit"
[master (root-commit) 46f1533] first commit
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 README.md
boyatekiMacBook-Pro-2:weibo zbj$ git remote add origin https://git.oschina.net/zbsourcecode/weibo.git
boyatekiMacBook-Pro-2:weibo zbj$ git push -u origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 206 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://git.oschina.net/zbsourcecode/weibo.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.
boyatekiMacBook-Pro-2:weibo zbj$ cd /Users/zbj/Desktop/Weibo
boyatekiMacBook-Pro-2:Weibo zbj$ git remote add origin https://git.oschina.net/zbsourcecode/weibo.git
fatal: Not a git repository (or any of the parent directories): .git
boyatekiMacBook-Pro-2:Weibo zbj$ open .
boyatekiMacBook-Pro-2:Weibo zbj$ cd /Users/zbj/项目/osChina/weibo
boyatekiMacBook-Pro-2:weibo zbj$ git add .
boyatekiMacBook-Pro-2:weibo zbj$ git add ./
boyatekiMacBook-Pro-2:weibo zbj$ git commit -m "添加已有的项目"
[master 2364694] 添加已有的项目
 441 files changed, 24645 insertions(+)
 create mode 100644 Weibo/Weibo.xcodeproj/project.pbxproj
................................................
 create mode 100644 Weibo/WeiboTests/WeiboTests.m
boyatekiMacBook-Pro-2:weibo zbj$ git remote add origin https://git.oschina.net/zbsourcecode/weibo.git
fatal: remote origin already exists.
boyatekiMacBook-Pro-2:weibo zbj$ git push -u origin master
Counting objects: 600, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (592/592), done.
Writing objects: 100% (599/599), 1.78 MiB | 12.00 KiB/s, done.
Total 599 (delta 159), reused 0 (delta 0)
To https://git.oschina.net/zbsourcecode/weibo.git
   46f1533..2364694  master -> master
Branch master set up to track remote branch master from origin.
boyatekiMacBook-Pro-2:weibo zbj$
至此,提交成功

 

 
 

你可能感兴趣的:(OS)