如何将IntelliJ IDEA项目发布为Gist

时间:2017-10-29 18:15:24

标签: git github intellij-idea version-control gist

我有一个非常简单的IntelliJ IDEA项目,我想将其作为Gist发布。

GitHub不会让我创建一个Gist而不会在其中添加一些内容,所以我创建了一个单行文件gistfile1.txt

当我尝试将我的IDEA项目连接到Gist存储库时,它拒绝了我推送的尝试,显然是因为存在这个文件。我反复试过Fetch,Pull和Push,没有成功。

将项目连接到Gist的秘诀是什么?

更新:尝试使用Create Gist ...命令,但仍然被拒绝。最新的错误消息:

error: failed to push some refs to 'https://gist.github.com/1bf9d3b0ab2ebc7745e4780f9e7769fa.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
To https://gist.github.com/1bf9d3b0ab2ebc7745e4780f9e7769fa.git
hint: 'git pull ...') before pushing again.
!   refs/heads/master:refs/heads/master [rejected] (non-fast-forward)
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Done
17:00:16.729: [WorldSeriesOddsGist] git -c core.quotepath=false -c log.showSignature=false pull --progress --no-stat -v --progress origin master
From https://gist.github.com/1bf9d3b0ab2ebc7745e4780f9e7769fa
 * branch            master     -> FETCH_HEAD
 = [up to date]      master     -> origin/master
fatal: refusing to merge unrelated histories

更新2:我放弃了。这是最新一批错误消息。谁知道Gist不支持目录。它说它是一个普通的Git存储库,我认为这意味着目录。

18:24:12.754: [WorldSeriesOddsGist] git -c core.quotepath=false -c log.showSignature=false fetch origin --progress --prune
18:24:43.021: [WorldSeriesOddsGist] git -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/master:master
Counting objects: 10, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (10/10), 1.33 KiB | 0 bytes/s, done.
Total 10 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.        
remote: Gist does not support directories.        
remote: These are the directories that are causing problems:        
remote: .idea, net        
error: failed to push some refs to 'https://gist.github.com/RobLewis/1bf9d3b0ab2ebc7745e4780f9e7769fa'
To https://gist.github.com/RobLewis/1bf9d3b0ab2ebc7745e4780f9e7769fa
!   refs/heads/master:refs/heads/master [remote rejected] (pre-receive hook declined)
Done

1 个答案:

答案 0 :(得分:2)

创建新要点:

  1. 右键单击左窗格中的项目,然后选择Create Gist...
  2. 如果您不想将其与您的github帐户相关联,请点击匿名
  3. 输入说明
  4. 点击确定