我在projectlocker上设置了一个git项目来推送我的git文件.然后我进入了初始化git项目并暂存我的文件的目录.最后我尝试使用此命令将项目推送到projectlocker:
$ git push git-smichaels@free5.projectlocker.com:helloworld.git
Run Code Online (Sandbox Code Playgroud)
它会生成此错误:
warning: You did not specify any refspecs to push, and the current remote
warning: has not configured any push refspecs. The default action in this
warning: case is to push all matching refspecs, that is, all branches
warning: that exist both locally and remotely will be updated. This may
warning: not necessarily be what you want to happen.
warning:
warning: You can specify what action you want to take in this case, and
warning: …Run Code Online (Sandbox Code Playgroud) 每当我尝试将更改提交到我的github repo时,我都会收到此错误.
要git@github.com:antarr/3skeleton.git
![拒绝]主 - >主(非快进)
错误:未能将某些引用推送到'git@github.com:antarr/3skeleton.git'
为了防止您丢失历史记录,非快进更新被拒绝
在再次按下之前合并远程更改(例如'git pull').
有关详细信息,请参阅"git push --help"中的"关于快进的注意事项"部分.
如果我先做git pull,它会更改我机器上的一些文件.哪种失败的目的.
我刚做过第一次git push:
~/sb/ws> git push ~/gitrepo master:master
Counting objects: 1360, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (998/998), done.
Writing objects: 100% (1360/1360), 342.15 KiB | 20 KiB/s, done.
Total 1360 (delta 729), reused 0 (delta 0)
To /home/gitrepo
* [new branch] master -> master
Run Code Online (Sandbox Code Playgroud)
它似乎进展顺利,但是当gitk新的(裸)gitrepo 发生火灾时,我只看到提交注释:分支和标签名称消失了!
为什么?
有办法让他们回来吗?
好的,所以我在GitHub上有一个分叉的回购,而且自从我分叉后,上游回购没有更新.昨天,我创建了一个基于最后一次上游提交的分支,这是在我几个月前分配回购之前做的.
我在分支上做了一个错误的提交,所以我尝试通过git push -f origin HEAD^:master在我的本地分支实例上使用它来撤消它,但正如你所看到的,我忘了改为master分支的名称.所以它最终覆盖了我在主人身上所做的一切.
我的问题是,有没有办法解决这个混乱,所以我可以让主人回到这个特定的推动之前的状态?
我经常使用TortoiseGit和TortoiseSVN,在Git的任何组件之前我都看不到我在主服务器上做过的任何事情,但是我仍然可以在SVN trunk的历史日志中看到我之前的所有提交.我之前没有一个干净的本地主实例.
我试过的东西一样git reset --hard <last good commit hash>或git push -f origin <last good commit hash>:master,但它说,任何犯了这样的哈希存在.我仍然可以从浏览器历史记录中访问GitHub上的所有先前提交.
下游没有任何东西,所以不用担心.
有小费吗?
我使用以下命令设置了一个新的Git存储库:
mkdir plans-for-world-domination
cd plans-for-world-domination
git init
echo "MWA HA HA HA HA!" > plans.txt
git add .
git commit -m "Beginning my plans..."
Run Code Online (Sandbox Code Playgroud)
然后我复制了这个存储库,进行了一些更改,提交了它们,然后尝试推送:
cd ..
git clone plans-for-world-domination clone
cd clone
echo "Step 1: set up super secret spy base in Cleveland, Ohio" >> plans.txt
git commit -am "Update plans"
git push origin master
Run Code Online (Sandbox Code Playgroud)
当我cd回到plans-for-world-domination存储库时,staging-area/index中有一些更改与我刚刚推送的更改相反:
$ cd ../plans-for-world-domination
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD …Run Code Online (Sandbox Code Playgroud) 我一直在使用GitHub for Mac客户端.它已经完美地工作了两个月.昨天,在成功提交和推送后,我的客户端自行关闭然后重新启动.从那时起,我一直无法将更改推送到我的在线仓库.
在客户端,我收到消息"git media pre-push hook已过期.请运行git media update"
当我试图从终端推我收到此消息"混帐:'媒体’不是一个git命令见'的git --help’错误:.未能推动一些裁判为'[我的GitHub库URL.git]’"
有没有办法解决这些错误,让我的本地回购再次工作?如果可能的话,我真的不想创建一个新的本地回购.
如果我使用最新的代码强行推送了服务器,是否可以将我的master分支恢复到初始状态?我尝试了reflog命令,但由于它仅跟踪本地提交,因此无法正常工作。
谢谢
我被埋在一个混蛋中.
我是怎么到达那里的:
我不是一个git专家.如果我没有任何细节,请问我澄清一下.几天前我运行了以下命令将我的更改推送到远程分支.
% git checkout master
% git pull
% git checkout redactor_changes <-- this is the branch that I made my changes
% git commit -m "changes" # I added my changes previously
% git rebase master
% git push origin redactor_changes # pushed changes to remote branch
Run Code Online (Sandbox Code Playgroud)
并非每个人都具有将更改合并到主分支的写入权限.拥有远程回购的写入权限的人告诉我存在冲突并进行改变并再次提交.所以今天我按照确切的顺序运行了以下命令.
vagrant@vagrant-ubuntu-trusty-64:~/oblog$ git add oblog/static/css/styles-custom.css
vagrant@vagrant-ubuntu-trusty-64:~/oblog$ git add oblog/static/js/redactor.upload_image.js
vagrant@vagrant-ubuntu-trusty-64:~/oblog$ git add oblog/static/images/loading.gif
vagrant@vagrant-ubuntu-trusty-64:~/oblog$ git commit -m "Throw a toast when user upload an non-image file with image extension"
vagrant@vagrant-ubuntu-trusty-64:~/oblog$ …Run Code Online (Sandbox Code Playgroud) 在我有git add和git commit之后,我的工作区,索引缓存和本地存储库变得相同.那么我怎么知道什么时候"推",这个补丁集有什么区别?
我正在编写一个Python脚本,该脚本使用GitPython(https://gitpython.readthedocs.io/en/stable/)将本地文件提交到远程存储库。对文件进行编辑后,我设置了用户名和电子邮件的值,如以下代码片段所示:
repo = git.Repo.init("my local clone path")
repo.config_writer().set_value("name", "email", "myusername").release()
repo.config_writer().set_value("name", "email", "myemail").release()
repo.git.add("filename")
repo.git.commit("filename")
repo.git.push("my remote repo url")
Run Code Online (Sandbox Code Playgroud)
我总是遇到以下错误:
stderr: '
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
Run Code Online (Sandbox Code Playgroud)
即使我已经使用config_writer()函数设置了用户名和密码,如此处所述:http ://gitpython.readthedocs.io/en/stable/tutorial.html#handling-remotes
任何有关如何解决此问题的建议将不胜感激。
git ×10
git-push ×10
github ×3
git-reset ×2
git-branch ×1
git-commit ×1
git-merge ×1
git-pull ×1
git-reflog ×1
git-svn ×1
git-tag ×1
gitpython ×1
master ×1
python ×1
rebase ×1