【发布时间】:2016-11-12 03:02:34
【问题描述】:
我正在尝试将现有项目上传到 Github。
我正在使用 Git 2.3.5,因为较新的版本与 Mac OS X Lion (10.7.5) 不兼容。
我尝试使用git add eu,因为我在指南中找到了。结果是以下错误:
fatal: pathspec 'eu' did not match any files
我也试过git add . 和git add --all。它给了我一个完全空白的新行。
那么,如何将我现有的 Maven 项目上传到 Github?
- Mac OS X v10.7.5
- Git V2.3.5
新错误:
MBA-10-09:~ myname$ git push -u origin master
To https://github.com/myname/importer.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/myname/importer.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
MBA-10-09:~ myname$ git config --global pull.rebase true
MBA-10-09:~ myname$ git stash
Saved working directory and index state WIP on master: b1c9c72 Added Importer v0.1-Beta
HEAD is now at b1c9c72 Added Importer v0.1-Beta
MBA-10-09:~ myname$ git pull --rebase
warning: no common commits
remote: Counting objects: 10, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 10 (delta 1), reused 3 (delta 0), pack-reused 0
Unpacking objects: 100% (10/10), done.
From https://github.com/bys1/importer
* [new branch] master -> origin/master
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
There is no tracking information for the current branch.
Please specify which branch you want to rebase against.
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-to=origin/<branch> master
MBA-10-09:~ myname$ git stash pop
Removing README.md
On branch master
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: README.md
Untracked files:
(use "git add <file>..." to include in what will be committed)
.CFUserTextEncoding
.bash_history
.cache/
.config/
.cups/
.dropbox/
.eclipse/
.gitconfig
.gmwoommrc
.local/
.m2/
.mediafire/
.oracle_jre_usage/
.p2/
.sh_history
.ssh/
.tkyczxzn
Applications/
BuildData/
BuildTools.log.txt
Bukkit/
CraftBukkit/
Desktop/
Documents/
Downloads/
Dropbox/
Library/
Movies/
Music/
Pictures/
Public/
Spigot/
apache-maven-3.2.5/
craftbukkit-1.10.jar
magic.mgc
spigot-1.10.jar
work/
It took 2.42 seconds to enumerate untracked files. 'status -uno'
may speed it up, but you have to be careful not to forget to add
new files yourself (see 'git help status').
no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (3eb015298d6369d65ba7551f0f81178b63cc119e)
【问题讨论】:
-
Git 不关心(甚至不知道)Java 包或 Maven 工件 ID。你的目录结构是什么?您是添加新文件还是推送现有提交有问题?
-
我正在尝试将我的项目上传到 Github,但是 git add --all 没有做任何事情。
-
我是 Github 新手,但没想到会这样。
-
但是你说你有一个“现有项目”。您是否已经有一个本地 Git 存储库来保存该项目?
git add --all只添加已经被跟踪的文件。 -
我在 Eclipse 中有一个 Maven 项目。不知道我是否有任何本地存储库,我该如何找到?我是 Github 的菜鸟。