git 将本地项目提交到第三方简单操作

1、已有本地项目文件夹

2.在1的文件夹下git init

$ git initInitialized empty Git repository in C:/usertb/cart1.4.0.0/.git/

发现多了master字样

tb@tb MINGW64 /c/usertb/cart1.4.0.0 (master)

创建个文件演示下

$ touch read.utb@tb MINGW64 /c/usertb/cart1.4.0.0 (master)

添加文件到本地

$ git add read.utb@tb MINGW64 /c/usertb/cart1.4.0.0 (master)

提交到本地,写个注释

$ git commit -m 'just fc'[master (root-commit) 27cf218] just fc Committer: unknown Your name and email address were configured automatically basedon your username and hostname. Please check that they are accurate.You can suppress this message by setting them explicitly:    git config --global user.name "Your Name"    git config --global user.email you@example.comAfter doing this, you may fix the identity used for this commit with:    git commit --amend --reset-author 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 read.u

3.去gitoschina conding.net github 等创建分支

比如链接为http://git.oschina.net/mysina...

4、本地基础添加远程分支,名字我叫cartnote

tb@tb MINGW64 /c/usertb/cart1.4.0.0 (master)$ git remote add cartnote http://git.oschina.net/mysina/cart_note

5、试着push上去

$ git push cartnote masterTo http://git.oschina.net/mysina/cart_note ! [rejected]        master -> master (fetch first)error: failed to push some refs to 'http://git.oschina.net/mysina/cart_note'hint: Updates were rejected because the remote contains work that you dohint: not have locally. This is usually caused by another repository pushinghint: to the same ref. You may want to first integrate the remote changeshint: (e.g., 'git pull ...') before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details.

6、他那意思可能是要pull下before push,听他的

$ git pullfatal: No remote repository specified.  Please, specify either a URL or aremote name from which new revisions should be fetched.tb@tb MINGW64 /c/usertb/cart1.4.0.0 (master)$ git pull cartnotewarning: no common commitsremote: 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 http://git.oschina.net/mysina/cart_note * [new branch]      master     -> cartnote/masterYou asked to pull from the remote 'cartnote', but did not specifya branch. Because this is not the default configured remotefor your current branch, you must specify a branch on the command line.

好了吧?

7、还是有错,咋回事?

tb@tb MINGW64 /c/usertb/cart1.4.0.0 (master)$ git pull cartnoteYou asked to pull from the remote 'cartnote', but did not specifya branch. Because this is not the default configured remotefor your current branch, you must specify a branch on the command line.tb@tb MINGW64 /c/usertb/cart1.4.0.0 (master)

我们需要指定下pull的url

$ git pull http://git.oschina.net/mysina/cart_noteFrom http://git.oschina.net/mysina/cart_note * branch            HEAD       -> FETCH_HEADAlready up-to-date!Merge made by the 'recursive' strategy.

8、好,这次应该可以

到现在第一个测试文件已经上去了,我们接下来把项目文件扔上去

$ git push cartnote master
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 339 bytes | 0 bytes/s, done.
Total 4 (delta 1), reused 0 (delta 0)
To http://git.oschina.net/mysina...
10120ee..9f7c085 master -> master

9、添加所有

git add *git commit -m ‘add*’git push cartnote masterCounting objects: 4247, done.Delta compression using up to 4 threads.Compressing objects: 100% (4122/4122), done.Writing objects:  28% (1196/4247), 1.51 MiB | 178.00 KiB/s

9.5 wtf,hung up。。

$ git push cartnote masterCounting objects: 4247, done.Delta compression using up to 4 threads.Compressing objects: 100% (4122/4122), done.error: unable to rewind rpc post data - try increasing http.postBuffererror: RPC failed; curl 56 Recv failure: Connection was resetThe remote end hung up unexpectedly4.98 MiB | 24.00 KiB/sfatal:Writing objects: 100% (4247/4247), 14.69 MiB | 561.00 KiB/s, done.Total 4247 (delta 1081), reused 0 (delta 0)fatal: The remote end hung up unexpectedlyEverything up-to-date看看这错误。。。。

10.等着9.5完成就好啦~

关键字:git

版权声明

本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处。如若内容有涉嫌抄袭侵权/违法违规/事实不符,请点击 举报 进行投诉反馈!

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部