Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GIT-无法推送,因为我的路径由GIT解释_Git_Ssh - Fatal编程技术网

GIT-无法推送,因为我的路径由GIT解释

GIT-无法推送,因为我的路径由GIT解释,git,ssh,Git,Ssh,在我的服务器“源代码”上,我执行以下操作: 在我的本地笔记本上,我会: git push AyamJ@sourcecode:/home/AyamJ/pbGIT master 我得到一个错误: git:'/home/AyamJ/pbGIT' is not a git command. See 'git --help' fatal: the remote end hung up enexpectedly 在我的~/.ssh/config上 Host sourcecode user AyamJ p

在我的服务器“源代码”上,我执行以下操作:

在我的本地笔记本上,我会:

git push AyamJ@sourcecode:/home/AyamJ/pbGIT master
我得到一个错误:

git:'/home/AyamJ/pbGIT' is not a git command. See 'git --help'
fatal: the remote end hung up enexpectedly
在我的~/.ssh/config上

Host sourcecode
user AyamJ
port 31313
Host localhost
user Dell
port 22
为什么git会解释这条路径

==更新==

我有两个服务器(通过git--bare init)“localhost”和“sourcecode”

我知道


这两台服务器都有类似的cygwin和package。

如果您有配置文件,则应使用:

git push sourcecode:/home/AyamJ/pbGIT master
之后,请尝试:

GIT_TRACE=1 git push sourcecode:/home/AyamJ/pbGIT master
然后签出“”:
添加一个
--receive pack='git receive pack'
可能会有所帮助。
或者至少是一个
git配置--global remote.origin.receivepack“git receive pack”

看看你有没有一套

请确保在最新的Git版本中试用,以查看问题是否仍然存在。

使用相对路径 使用相对路径,它可能会起作用:

git push AyamJ@sourcecode:pbGIT master
我不确定原因,但是用abs路径测试它对我来说失败了,所以这可能是你的错误的一部分但是这不是使用git的正常方式

正常 首先,确保ssh配置设置为不需要用户名和密码,即这应该可以工作:

(notebook)$ ssh sourcecode
...
(server)$
在本地git repo上-创建指向远程服务器存储库的

(notebook)$ git remote add sourcecode:pbGIT origin
(notebook)$ git push
最后一个命令没有参数是经过深思熟虑的——对于最新版本的git,它将给出如下错误消息:

fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
   git push --set-upstream origin <current branch name>
从这一点出发,不必使用带有
git push
git pull

反过来做 当从头开始时,或者如果远程存储库已经存在,那么用另一种方法来做这些事情实际上更容易

(notebook)$ ssh sourcecode
...
(sourcecode)$ mkdir x.git
(sourcecode)$ cd x.git
(sourcecode)$ git init --bare
(sourcecode)$ exit
(notebook)$ git clone sourcecode:x.git
Cloning into 'x'...
warning: You appear to have cloned an empty repository.
注意,上面提到的远程git存储库是在一个名为
whatever.git
的文件夹中创建的-这只是一个识别git文件夹/存储库的约定,没有任何特殊意义,尽管在所有示例中可能都有

如果在此之后查看上的
.git/config
文件,您将看到如下内容:

(notebook)$ cd x; more .git/config
    [core]
    repositoryformatversion = 0 
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = sourcecode:x.git
[branch "master"]
    remote = origin
    merge = refs/heads/master

这表示远程源代码指向源代码服务器,并且存在的一个分支,
master
,跟踪远程
origin

i do GIT_TRACE=1,get TRACE:build-in:GIT“push”sourcecode:/home/AyamJ/pbGIT“master”,trace:run_命令:“ssh”“sourcecode”“git receive pack'\''/home/AyamJpbGIT'\''@kreamik您可以使用该命令的完整跟踪编辑您的问题。然后首先尝试一个
git配置--global remote.origin.receivepack“git receive pack”
。我已经添加了这个全局配置。。我还应该补充什么线索呢?“一切都是最新的”:看来你的推动已经奏效了,不是吗(对于
Dell
)?
Adam
Dell
回购目录和父目录之间是否存在任何正确的问题(保护差异)?为什么同时使用
sourcecode:
?您是否应该
localhost:
用于Dell(如果我正确读取了您的ssh配置文件)?唯一不同的是:用户AyamJ是由网络用户“AyamJ password/add/yes和mkpassd-l-u AyamJ>>/etc/passwd”创建的,Dell实际上是本地用户。你说得对,戴尔的源代码是localhost
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
   git push --set-upstream origin <current branch name>
git push --set-upstream origin master
(notebook)$ ssh sourcecode
...
(sourcecode)$ mkdir x.git
(sourcecode)$ cd x.git
(sourcecode)$ git init --bare
(sourcecode)$ exit
(notebook)$ git clone sourcecode:x.git
Cloning into 'x'...
warning: You appear to have cloned an empty repository.
(notebook)$ cd x; more .git/config
    [core]
    repositoryformatversion = 0 
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = sourcecode:x.git
[branch "master"]
    remote = origin
    merge = refs/heads/master