我想按照这个指示.我有一个本地git repo,当我进行git推送时,我需要将repo推送到我的EC2实例.
但是,在上面的教程中,当我这样做时git push origin master
,我收到Permission denied (publickey)
错误,因为我没有指定身份文件.
说,我这样登录EC2: ssh -i my_key.pem username@11.111.11.11
那么,我可以在这里做类似的事情:git -i my_key.pem push origin master
或者设置身份文件.git/config
那么,我该如何设置呢?
更新:输出 git config -l
user.name=my name
user.email=my_email_addreess@gmail.com
github.user=userid
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
remote.origin.url=ec2_id@my_e2_ip_address:express_app
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
Run Code Online (Sandbox Code Playgroud)
更新(来自@ Jon的评论):
如果你的钥匙在奇数路径上运行ssh-add /private/key/path
.这对我有用.
描述有点简洁.我只是在我的本地主分支上添加了一个文件并将其推回到远程仓库.知道为什么会这样吗?
warning: updating the current branch warning: Updating the currently checked out branch may cause confusion, warning: as the index and work tree do not reflect changes that are in HEAD. warning: As a result, you may see the changes you just pushed into it warning: reverted when you run 'git diff' over there, and you may want warning: to run 'git reset --hard' before starting to work to recover. warning: warning: You can set 'receive.denyCurrentBranch' configuration variable to warning: …
我有一个Git存储库.我克隆了存储库,可以提交我的本地更改.当我将更改推送到服务器时,它可以工作.
一旦我创建了一个分支,我就会检查分支,提交我的工作,然后检查主分支.然后我将我的本地更改合并到主分支中.当我尝试推送到服务器时,我得到以下异常:
Welcome to Git (version 1.7.11-preview20120620)
Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
$ git push origin master:master
Counting objects: 9, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (8/8), 13.68 KiB, done.
Total 8 (delta 2), reused 1 (delta 0)
Unpacking objects: 100% (8/8), done.
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, …
Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用GIT(我来自cvs)并希望使用Git设置类似于cvs/svn的东西.我执行了以下步骤:
cd o:/repository
git init
cd <working directory>
git clone o:/repository
Run Code Online (Sandbox Code Playgroud)
我现在创建了一个名为file.txt的文件,其中一些内容执行"git status"列出了适当的更改.
然后我做
git add file.txt
git commit file.txt
Run Code Online (Sandbox Code Playgroud)
两者似乎都很好.
当我这样做时
git push
,我收到以下错误:
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'o:/repository'
Run Code Online (Sandbox Code Playgroud)
我首先尝试执行pull,以及为push命令指定origin和master变量但是没有工作.
有人可以告诉我我错过了什么.我正在运行Windows 7 64位.
PS.我也试过了
git push origin master
Run Code Online (Sandbox Code Playgroud)
我得到以下内容:
Counting objects: 3, done.
Writing objects: 100% (3/3), 251 bytes, done.
Total …
Run Code Online (Sandbox Code Playgroud)