osChina终端命令上传代码

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

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

$ ssh -T [email protected]

//若返回
Welcome to [email protected], zb_j!

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

boyatekiMacBook-Pro-2:~ zbj$ cd /Users/zbj/项目/osChina/weibo/Weibo
boyatekiMacBook-Pro-2:Weibo zbj$ git init
Initialized empty Git repository in /Users/zbj/项目/osChina/weibo/Weibo/.git/
boyatekiMacBook-Pro-2:Weibo zbj$ git init .
Reinitialized existing Git repository in /Users/zbj/项目/osChina/weibo/Weibo/.git/
boyatekiMacBook-Pro-2:Weibo zbj$ cd /Users/zbj/项目/osChina
boyatekiMacBook-Pro-2:osChina zbj$ git pull [email protected]:zbsourcecode/weibo.git
fatal: Not a git repository (or any of the parent directories): .git
boyatekiMacBook-Pro-2:osChina zbj$ git init .
Initialized empty Git repository in /Users/zbj/项目/osChina/.git/
boyatekiMacBook-Pro-2:osChina zbj$ git pull [email protected]:zbsourcecode/weibo.git
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 5 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (5/5), done.
From git.oschina.net:zbsourcecode/weibo
 * branch            HEAD       -> FETCH_HEAD
boyatekiMacBook-Pro-2:osChina zbj$ git add -A .
boyatekiMacBook-Pro-2:osChina zbj$ git commit -am "第一次提交远程代码"
On branch master
nothing to commit, working directory clean
boyatekiMacBook-Pro-2:osChina zbj$ git add -A Weibo/.
boyatekiMacBook-Pro-2:osChina zbj$ git commit -am "第一次提交远程代码"
On branch master
Untracked files:
    Weibo.textClipping

nothing added to commit but untracked files present
boyatekiMacBook-Pro-2:osChina zbj$ git rm Weibo.textClipping
fatal: pathspec ‘Weibo.textClipping‘ did not match any files
boyatekiMacBook-Pro-2:osChina zbj$ git commit -am "第一次提交远程代码"
On branch master
nothing to commit, working directory clean
boyatekiMacBook-Pro-2:osChina zbj$ git status
On branch master
nothing to commit, working directory clean
boyatekiMacBook-Pro-2:osChina zbj$ git commit -m "第一次提交远程代码"
On branch master
nothing to commit, working directory clean
boyatekiMacBook-Pro-2:osChina zbj$ cd Weibo
boyatekiMacBook-Pro-2:Weibo zbj$ git add .
Assertion
failed: (item->nowildcard_len <= item->len &&
item->prefix <= item->len), function prefix_pathspec, file
pathspec.c, line 317.
Abort trap: 6
boyatekiMacBook-Pro-2:Weibo zbj$ cd /Users/zbj/项目/osChina
boyatekiMacBook-Pro-2:osChina zbj$ git add Weibo/
fatal: Unable to create ‘/Users/zbj/项目/osChina/.git/index.lock‘: File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
boyatekiMacBook-Pro-2:osChina zbj$ git add Weibo/.
fatal: Unable to create ‘/Users/zbj/项目/osChina/.git/index.lock‘: File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
boyatekiMacBook-Pro-2:osChina zbj$ cd /Users/zbj/项目/osChina
boyatekiMacBook-Pro-2:osChina zbj$ git init
Initialized empty Git repository in /Users/zbj/项目/osChina/.git/
boyatekiMacBook-Pro-2:osChina zbj$ git remote add origin [email protected]:zbsourcecode/weibo.git
boyatekiMacBook-Pro-2:osChina zbj$ git add .
boyatekiMacBook-Pro-2:osChina zbj$ git commit -a -m "第一次提交"
[master (root-commit) b2bf26b] 第一次提交
 441 files changed, 24645 insertions(+)
 create mode 100644 Weibo.xcodeproj/project.pbxproj
............................................................
 create mode 100644 WeiboTests/WeiboTests.m
boyatekiMacBook-Pro-2:osChina zbj$ git pull origin master
warning: no common commits
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 5 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (5/5), done.
From git.oschina.net:zbsourcecode/weibo
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
Adding Weibo/main.m
................................................
Adding Weibo/Base.lproj/LaunchScreen.xib
CONFLICT
(directory/file): There is a directory with name Weibo in HEAD. Adding
Weibo as Weibo~3b0a93b55a67db54b9797b66856335c9fffe04c4
Automatic merge failed; fix conflicts and then commit the result.
boyatekiMacBook-Pro-2:osChina zbj$ open .
boyatekiMacBook-Pro-2:osChina zbj$ cd /Users/zbj/项目/osChina/weibo
boyatekiMacBook-Pro-2:weibo zbj$ git init
Initialized empty Git repository in /Users/zbj/项目/osChina/weibo/.git/
boyatekiMacBook-Pro-2:weibo zbj$ git remote add orgin [email protected]:zbsourcecode/weibo.git
boyatekiMacBook-Pro-2:weibo zbj$ git add .
boyatekiMacBook-Pro-2:weibo zbj$ git commit -a -m "第一次初始化"
On branch master

Initial commit

nothing to commit
boyatekiMacBook-Pro-2:weibo zbj$ git pull origin master
fatal: ‘origin‘ does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
boyatekiMacBook-Pro-2:weibo zbj$ open .
boyatekiMacBook-Pro-2:weibo zbj$ git add .
boyatekiMacBook-Pro-2:weibo zbj$ git commit -a -m "第一次初始化"
[master (root-commit) 4050f49] 第一次初始化
 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 pull origin master
fatal: ‘origin‘ does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
boyatekiMacBook-Pro-2:weibo zbj$ open push orgin master
The
files /Users/zbj/项目/osChina/weibo/push,
/Users/zbj/项目/osChina/weibo/orgin, and
/Users/zbj/项目/osChina/weibo/master do not exist.
boyatekiMacBook-Pro-2:weibo zbj$ git push origin master
fatal: ‘origin‘ does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
boyatekiMacBook-Pro-2:weibo zbj$ clear

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$
至此,提交成功

时间: 2024-10-12 16:33:12

osChina终端命令上传代码的相关文章

[转]使用git命令上传代码

http://jiajing.elastos.org/2013/04/15/%E4%BD%BF%E7%94%A8git%E5%91%BD%E4%BB%A4%E4%B8%8A%E4%BC%A0%E4%BB%A3%E7%A0%81/ 一开始不熟悉git工具,在上传代码时闹了笑话,于是这里贴出使用方法,供以后参考. 1)在准备提交(上传)代码时,先使用git status查看被修改过的文件列表,如图: 红色字体分为两部分,第一部分是被修改过的文件:第二部分是新添加的文件. 2)参考git status

Git shell命令上传代码

创建Repository步骤: 1.创建本地文件夹 2.进入文件夹,执行 git init 初始化后git会对此文件夹中的文件进行版本控制 3.在远程服务器(如 github)上创建一个Repository,记下SSH 4.执行 git remote add <一个名字> <SSH> 以后可以通过这个名字向对应的Repository提交代码 5.提交代码 创建Repository前对Git的配置工作: git config --global user.name "你的名字

git命令上传代码到码云

一.进入相应文件夹 git add . 二. git commit -m "717"//注释 三.上传到个人分支 git push -u origin 张金钗 //分支 原文地址:https://www.cnblogs.com/chaihtml/p/11203300.html

git 命令--上传代码

创建密钥命令: ssh-keygen -C '[email protected]' -t rsa 找到生成的密钥文件id_rsa.pub 地址:C:\Documents and Settings\Administrator\.ssh\id_rsa.pub复制,然后添加到github账号上 输入命令:$ ssh –T [email protected] 如果提示:Hi defnngj You've successfully authenticated, but GitHub does not pr

linux(centos)下安装git并上传代码些许步骤(亲自验证过的步骤)

 以前听说了好多次github,但直到最近才第一次学习使用github来托管自己在linux下的代码!说实话,我自己在使用的时候从网上查了好多教程,但总觉得难以掌握(步骤过于繁琐),自己操作的时候还是蛮复杂的!(老实说是自己的理解能力不够)不过最终还是通过自己的摸索,学会了装载github并使用命令上传代码进行托管.     首先在使用git托管自己的代码之前,先要去git官方网站注册一个账号(注册的过程可以参考教程上的指导)步骤如下: (1)登录网址:https://github.com  填

git 上传代码到GitHub 以及git删除github上文件和文件的命令

Git入门 如果你完全没有接触过Git,你现在只需要理解通过Git的语法(敲入一些命令)就可以将代码上传到远程的仓库或者下载到本地的仓库(服务器),可知我们此时应该有两个仓库,就是两个放代码的地方,一个是本地,一个是远程的(如Github).企业或者团队可以通过Git来对项目进行管理,每个程序员只需将自己的本地仓库写好的代码上传到远程仓库,另一个程序员就可以下载到本地仓库了.今天我们就从Git终端软件的安装开始,再这之前我也简单介绍一下Github. Git上传代码 一.准备工作 1.注册一个g

通过命令行上传代码到GitHub

自工作以来,本人第一次使用GitHub.下面是将本地的项目上传到GitHub的过程.上传代码的前提是:1.已注册GitHub账号:2.本地已安装Git. 第一步:远程Git仓库 进入本地的项目的根目录下,执行Git命令 git init 第二步:将项目的所有文件添加到仓库中 git add . 如果想添加某个特定的文件,只需把.换成特定的文件名即可 第三步:将add的文件commit到仓库 git commit -m "注释语句" 第四步:在GitHub上创建自己的Repository

Git命令拉代码与上传代码

上传代码步骤: 1.进入到本地的文件夹内,git初始化:git init 2.将代码放到暂存区:git add . 3.提交代码到本地分支:git commit -m "备注" 4.push代码到远程仓库:git push origin [local branch]:[remote branch] eg:git push origin LOL origin/LOL 推送本地分支到远程新分支:git push origin local_branch:remote_branch local

使用Xcode上传代码至GitHub

几乎所有iOS程序员都上过GitHub寻找开源类库,的确,GitHub上有大量优秀的开源类库供大家学习.但是如何在Xcode中上传代码至GitHub呢? (开始之前先安装git,具体方法这里讲的很清楚:http://git.oschina.net/progit/1-起步.html) 开始 首先我们新建一个工程,记得要勾选Create git repository on: 这说明使用Source Control,会默认在工程中创建git repository.然后工程新建完成后,会在右侧边栏看到这