我如何使用Git初始推送到远程存储库? [英] How do I do an initial push to a remote repository with Git?

查看:86
本文介绍了我如何使用Git初始推送到远程存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了无数的教程,我一直在写。这是我得到的:



- 我在Windows桌面上运行RubyMine

- 我在我的上面安装了Git WebFaction托管帐户按照他们的说明

- Git在两台机器上都能正常工作



以下是我正在做的事:


1.在服务器上:

          a。 mkdir 项目

          b。 git init

          c。 git add。

          d。 git commit< ---nothing to commit

2.在客户端上:

          ;一个。在RubyMine中创建新项目。

          b。项目顶部目录中的git init
推送更改到服务器< ----未能将一些refs推送到......。



我缺少什么步骤?

  

解决方案 > mkdir my_project.git
cd my_project.git
git --bare init

在客户端:

  mkdir my_project 
cd my_project
touch .gitignore
git init
git add。
git commit -m初始提交
git remote add origin youruser@yourserver.com:/path/to/my_project.git
git push origin master

请注意,添加原点时,可以使用多种格式和模式。我建议你看看你的托管服务提供什么。


I've read through countless tutorials and I keep coming up short. Here's what I've got:

-- I'm running RubyMine on my Windows desktop
-- I've installed Git on my WebFaction hosting account per their instructions
-- Git appears to be working fine on both machines

Here's what I'm doing:
1. On server:
         a. mkdir project
         b. git init
         c. git add .
         d. git commit <--- "nothing to commit"
2. On client:
         a. Create new project in RubyMine.
         b. "git init" in top directory of project
         c. "Push changes" to server <---- "failed to push some refs to...".

What steps am I missing?

解决方案

On server:

mkdir my_project.git
cd my_project.git
git --bare init

On client:

mkdir my_project
cd my_project
touch .gitignore
git init
git add .
git commit -m "Initial commit"
git remote add origin youruser@yourserver.com:/path/to/my_project.git
git push origin master

Note that when you add the origin, there are several formats and schemas you could use. I recommend you see what your hosting service provides.

这篇关于我如何使用Git初始推送到远程存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆