为什么我的git push返回致命错误? [英] Why is my git push returning with fatal error?

查看:265
本文介绍了为什么我的git push返回致命错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要尝试的操作



这是我的初始设置,我没有成功推送或拉这个服务器,我已经验证,我可以添加文件到存储库,并且git通过更改和看到它跟踪文件,在repo内部工作,但我发现,推和拉到服务器或甚至在服务器上还不工作。



我在Centos上在Godaddy.com专用服务器上成功安装了git,这花了一段时间,但我终于找到了。



我在设置一个以网页为中心的工作流程时遵循这些说明,例外的是我希望在推送到我们的生产文件夹之前有一个地方来测试推送到服务器的内容。 http://joemaller.com/990/a-web-focused-git-工作流/



我已经开发了一个php / mysql应用程序,我已经tar滚球,并从我的mac上传到我的服务器,并解压到文件夹

然后我初始化了 marketing 作为git仓库,并将该文件夹复制到我们服务器相同文件夹级别的 devmarketing 文件夹。

我在 devmarketing 文件夹中运行 git init ,将其重新初始化为一个repo,因为它是一个副本

然后我创建了一些裸存储库,我将在下面解释。



结构如下:



当我推送一个测试文件夹( public_html / devmarketing / )时,我想要自动更新它:

  /samiam/dev_market_hub.git 


$ b b

当我推送 devmarketing public_html / marketing / c>:

  /samiam/market_hub.git 

我在存储库(裸和其他)上设置一些钩子,像上面建议的链接,但我不能确定它是否真的工作。



从我的 devmarketing 分支到我的营销分支时遇到错误:



 没有任何添加到提交但未跟踪的文件存在(使用git add跟踪)
root @ ip-XX-XXX-XXX-XXX [/ home / samiam / public-html / devmarketing]#git push master final
fatal:'master'似乎不是一个git仓库
fatal:远程端意外挂起
root @ ip-XX-XXX- XXX-XXX [/ home / samiam / public_html / devmarketing]#git push final
没有共同的引用和无指定;什么也不做。
也许你应该指定一个分支,如'master'。
fatal:远程结束意外挂起
错误:无法将某些引用推送到/home/samiam/market_hub.git'
root @ ip-XX-XXX-XXX-XXX [ / home / samiam / public_html / devmarketing]#git push master
fatal:'master'似乎不是一个git仓库
fatal:远程终端意外挂起

为了清楚起见,我有一个非裸的仓库( devmarketing 想要推送到一个裸回购( market_hub.git ),它应该更新 / marketing repo 。 >
文件夹结构再次是这样的裸资源库在 / home / samiam / 以粗体和非裸露 dev / production repos位于 / public_html / 文件夹中:

  root @ ip-XX-XXX-XXX-XXX [/ home / samiam]#ls -la(some ... omitted)
lrwxrwxrwx 1 samiam samiam 32 Jun 21 05:50 access-logs - > ; / usr / local / apache / domlogs / samiam /
drwxr-xr-x 7 root root 4096 Jul 13 11:34 dev_market_hub.git /
drwxr-xr-x 7 root root 4096 Jul 14 08: 48 market_hub.git /
drwxr-xr-x 3 samiam samiam 4096 Jun 21 05:46 public_ftp /
drwxr-xr-x 18 samiam nobody 4096 7月13日10:57 public_html /
lrwxrwxrwx 1 samiam samiam 11 Jun 21 05:46 www - > public_html /
root @ ip-XX-XXX-XXX-XXX [/ home / samiam]#cd public_html
root @ ip-XX-XXX-XXX-XXX [/ home / samiam / public_html]# ls -la
drwxr-xr-x 20 samiam samiam 4096 Jul 13 10:57 devmarketing /
drwxrwxrwx 20 samiam samiam 4096 Jul 13 08:12 marketing /
root @ ip-XX-XXX -XXX-XXX [/ home / samiam / public_html]#

最后,我想推送到钩子更新 devmarketing ,那个裸的仓库是 /samiam/dev_market_hub.git ,但这在当下不太重要,只要我可以在测试文件夹( devmarketing )中开发,然后推送到我们的生产版本,我将立即解决这个问题。



配置devmarket:

  [core] 
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remotedevhub]
url = /home/samiam/dev_market_hub.git
fetch = + refs / / market_hub的头/ *:refs / remotes / hub / *



git:



  [core] 
repositoryformatversion = 0
filemode = true
bare = true



for /market_hub.git / hooks / post-update



 #!/ bin / sh 

echo
****将更改推入市场[Hub的更新后钩子]
echo

cd / home / samiam / public_html / marketing || exit
unset GIT_DIR
git pull hub master

exec git-update-server-info



config:



  
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remotehub]
url = / home / samiam / market_hub .git
fetch = + refs / heads / *:refs / remotes / dev / *


b $ b

这是因为我想看看是否可以将dev repo推送到生产库,因为我目前正在开发我的应用程序。



如果你没有时间帮助,只是让我知道我需要得到这个解决。

解决方案

失败的是:

  git push master final 
git push final
git push master

如果你有一个远程命名为' final ,应为

  git push final master 

(为了建立指向上游库的链接,新创建的分支' master '






远程,像

  git push devhub master 

或添加一个名为final的远程:

  git remote add final / path 

确保这些路径没有错字:它们必须指向一个路径!




  • 存在(区分大小写的路径)

  • 可访问(检查是否具有读/ li>

What I am Trying To Do

This is my initial setup and I have not not made a successful push or pull on this server, I have verified that I can add files to a repository and that git is working inside a repo by making changes and seeing it track the files, but I am finding that pushing and pulling to the server or even on the server does not work yet.

I installed git on Centos on a Godaddy.com dedicated server successfully, this took awhile but I finally figured it out.

I followed these instructions when setting up a web focused workflow with the exception that I would prefer having a place to test what has been pushed to the server before I push it to our production folder. http://joemaller.com/990/a-web-focused-git-workflow/

I have developed a php/mysql application that I have tar balled and uploaded from my mac to my server and un-tarred it to folder called it 'marketing' under public_html.
Then I initialized marketing as a git repo, and copied that folder to a folder called 'devmarketing' at the same folder level of our server.
I ran git init in the devmarketing folder, this re-initialized it as a repo since it was a copy of a repo.
Then I created some bare repositories that I will explain below.

The structure looks like this:

Bare repository that I want to auto update a testing folder ( public_html/devmarketing/ ) when I push to it:

/samiam/dev_market_hub.git

Bare repository that I want to auto update a production folder ( public_html/marketing/ ) when I push from devmarketing:

/samiam/market_hub.git

I set some hooks on the repositories (bare and the other) like the link above suggested, but I can't tell if it is really working or not.

I encountered an error when pushing from my devmarketing branch to my marketing branch:

nothing added to commit but untracked files present (use "git add" to track)
root@ip-XX-XXX-XXX-XXX [/home/samiam/public_html/devmarketing]# git push master final
fatal: 'master' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
root@ip-XX-XXX-XXX-XXX [/home/samiam/public_html/devmarketing]# git push final
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to '/home/samiam/market_hub.git'
root@ip-XX-XXX-XXX-XXX [/home/samiam/public_html/devmarketing]# git push master
fatal: 'master' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

Just to be clear I have a non-bare repo (devmarketing) that I want to push from to a bare repo (market_hub.git) which should in turn update /marketing repo.
The folder structure again is like this the bare repos are in /home/samiam/ in bold and the non bare dev/production repos are in the /public_html/ folder:

root@ip-XX-XXX-XXX-XXX [/home/samiam]# ls -la (some ... omitted)
lrwxrwxrwx  1 samiam samiam   32 Jun 21 05:50 access-logs -> /usr/local/apache/domlogs/samiam/
drwxr-xr-x  7 root   root   4096 Jul 13 11:34 dev_market_hub.git/
drwxr-xr-x  7 root   root   4096 Jul 14 08:48 market_hub.git/
drwxr-xr-x  3 samiam samiam 4096 Jun 21 05:46 public_ftp/
drwxr-xr-x 18 samiam nobody 4096 Jul 13 10:57 public_html/
lrwxrwxrwx  1 samiam samiam   11 Jun 21 05:46 www -> public_html/
root@ip-XX-XXX-XXX-XXX [/home/samiam]# cd public_html
root@ip-XX-XXX-XXX-XXX [/home/samiam/public_html]# ls -la
drwxr-xr-x 20 samiam samiam     4096 Jul 13 10:57 devmarketing/
drwxrwxrwx 20 samiam samiam     4096 Jul 13 08:12 marketing/
root@ip-XX-XXX-XXX-XXX [/home/samiam/public_html]# 

Eventually I would like to push to a hook that updates devmarketing, that bare repo is /samiam/dev_market_hub.git, but that is less important at the moment, as long as I can develop in a test folder (devmarketing) and then push to our production version I will settle for that for right now.

config for devmarket:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "devhub"]
        url = /home/samiam/dev_market_hub.git
        fetch = +refs/heads/*:refs/remotes/hub/*
~  

config for /market_hub.git:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = true

~

for /market_hub.git/hooks/post-update

#!/bin/sh

echo
echo "**** Pulling changes into Marketing [Hub's post-update hook]"
echo

cd /home/samiam/public_html/marketing || exit
unset GIT_DIR
git pull hub master

exec git-update-server-info
     ~                                                                                                                                                                                                   

config for /marketing repo##:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "hub"]
        url = /home/samiam/market_hub.git
        fetch = +refs/heads/*:refs/remotes/dev/*
~                                                   

This was because I wanted to see if I could push form the dev repo to the production repo because I am currently working on developing my app too.

If you don't have time to help just let me know I need to get this resolved.

解决方案

The commands that were unsuccessful were:

git push master final
git push final
git push master

An first push, if you have a remote named 'final', should be

git push final master

(in order to establish a link to the upstream repo new created branch 'master')


So you either have to push to an exisiting remote, like

git push devhub master

Or add a remote named final:

git remote add final /an/existing/path

Make sure those path are without typo: they must point to a path!

  • that exists (case sensitive path)
  • that is accessible (check if you have read/write access)

这篇关于为什么我的git push返回致命错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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