Don*_*hes 152 git version-control
我已经阅读了无数的教程,并且我一直在努力.这是我得到的:
- 我在我的Windows桌面上运行RubyMine
- 我按照他们的指示在我的WebFaction主机帐户上安装了Git
- Git似乎在两台机器上都运行正常
这就是我正在做的事情:
1.在服务器上:
a.mkdir 项目
b.git init
c.git add.
d.git commit <---"没什么可提交的"
2.在客户端:
a.在RubyMine中创建新项目.
湾 项目
c的顶级目录中的"git init" ."推送更改"到服务器<----"无法将某些引用推送到......".
我错过了哪些步骤?
Jos*_*sey 360
在服务器上:
mkdir my_project.git
cd my_project.git
git --bare init
Run Code Online (Sandbox Code Playgroud)
在客户端:
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
Run Code Online (Sandbox Code Playgroud)
请注意,添加原点时,可以使用多种格式和模式.我建议您查看您的托管服务提供的内容.
您可以尝试以下方法:
在服务器上:
向/etc/group
喜欢添加新组(示例)
mygroup:1001:michael,nir
Run Code Online (Sandbox Code Playgroud)
创建新的git仓库:
mkdir /srv/git
cd /srv/git
mkdir project_dir
cd project_dir
git --bare init (initial git repository )
chgrp -R mygroup objects/ refs/ (change owner of directory )
chmod -R g+w objects/ refs/ (give permission write)
Run Code Online (Sandbox Code Playgroud)
在客户端上:
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
Run Code Online (Sandbox Code Playgroud)
(感谢Josh Lindsey的客户端)
客户端之后,在服务器上执行以下命令:
cd /srv/git/project_dir
chmod -R g+w objects/ refs/
Run Code Online (Sandbox Code Playgroud)
如果在git pull之后出现此错误:
There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream new origin/<branch>
Run Code Online (Sandbox Code Playgroud)
尝试:
git push -u origin master
Run Code Online (Sandbox Code Playgroud)
我会帮你的。
小智 6
如果您的项目没有上游分支,也就是说,如果这是远程存储库第一次知道在本地存储库中创建的分支,则以下命令应该可以工作。
git push --set-upstream origin <branch-name>
Run Code Online (Sandbox Code Playgroud)