作者Allenbootung (不痛)
看板Soft_Job
标题[请益] push程式码的问题
时间Mon Aug 7 22:10:29 2017
各位大大好,小弟是程式开发的新手,工作上遇到技术上的问题想上来向大家求救。
请问要怎麽把本地档案push到没有装git的远端呢?
我首先切换到远端硬碟
cd //J-STATION
cd test/t3
git init
然後用Source Tree clone到 G:\xampp\htdocs\t3
本地做修改後 push,结果显示
-------
git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream origin master:master
Pushing to //J-STATION/test/t3
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To //J-STATION/test/t3
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to '//J-STATION/test/t3'
-------
照google解修改远端J-STATION的 .git/config
[receive]
denyCurrentBranch = ignore
没有错误讯息,但是J-STATOIN没有收到新增修改的档案。
如果是当初是用 git --bare init,则会少一层.git资料夹,
但push後一样什麽都没收到。
想请问版上的前辈们有没有相关经验分享或建议
或者推个关键字让小弟去查
先谢谢大家了
--
jQuery做事,开口不谈$後面啥都别想动。
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 114.26.236.117
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Soft_Job/M.1502115036.A.13B.html
1F:→ KeithYeh: 远端的bare repo 使用 git log 应该会看到新的 commit 08/07 22:32
看到了所有commit,git checkout master後有正常更新了,
感谢大大。
只是checkout都要先到低版本再checkout master不然会漏档案。
※ 编辑: Allenbootung (114.26.236.117), 08/07/2017 22:42:58
3F:推 Lleytonhewit: 走错棚吧..这跟工作职务几乎无关..跟Google比较有关 08/07 23:55
我看上面有人问merge就跟着问push。
4F:→ cha122977: 说起来,哪个版最适合讨论综合性的软体技术问题呢? 08/08 03:55
ask?
5F:推 hsnuonly: programing? 08/08 06:44
6F:→ hsnuonly: 重复字尾被吃掉了… 08/08 06:45
7F:推 abc0922001: 为什麽要checkout到低版本,用git checkout -f . 08/08 09:28
8F:→ abc0922001: 也会漏档案吗? 08/08 09:28
感谢大大,学习了。
※ 编辑: Allenbootung (114.26.236.117), 08/08/2017 19:03:00
9F:嘘 PTTCATKING: 这是软体工作版,去技术版问好吗,知道也不告诉你 08/09 18:31