1
raptium 2014-08-08 19:15:09 +08:00 via Android
git remote set-url origin ....
|
2
konakona OP @raptium
[root@li671-193 CRAZYPHPER.COM]# git config user.name 'konakona' [root@li671-193 CRAZYPHPER.COM]# git config user.email '[email protected]' [root@li671-193 CRAZYPHPER.COM]# git push [email protected]'s password: 它现在让我输入git的帐号密码呢,我木有~ |
3
kchum 2014-08-08 19:49:15 +08:00 via iPhone
看不懂什么意思…
|
4
dorentus 2014-08-08 19:56:38 +08:00
git remote set-url origin [email protected]:xxxx/xxx.git
|
5
dorentus 2014-08-08 20:00:10 +08:00
git config 设置的名字和 email 只是用在 commit 信息里面的,和权限什么无关。
github 提供的两种 repo URL,https 的和 ssh 的,其中 https 的无论是加了用户名的还是不加用户名的,push 的时候都需要提供用户名和密码(不过似乎可以设置保存在本地什么地方)。ssh 的那种,在设置好 ssh public key 验证的情况下(1),push 和 pull 都不再会要输密码。 注1) https://github.com/settings/ssh |
7
akfish 2014-08-08 22:18:55 +08:00
你对你clone的那个repo有所有权没,没有你当然不能push。
|
8
lijinma 2014-08-08 23:00:46 +08:00
这种问题描述有种想摔电脑的冲动。
1. 你服务器 clone 了谁的 repo? 2. 你本机 clone 了谁的 repo? 3. 你是从本机 push 到 GitHub 上还是要 push 到服务器上? 讲问题讲清楚点啊。。 你如果 clone 了“别人”的代码而不是 clone 了自己 fork 的“别人”的代码,除非“别人”允许你 push 代码,否则你没有push的权限。 你如果要从你本机 push 到你自己的服务器,需要你自己 git remote add 你服务器的repo。 |
9
GhostFlying 2014-08-08 23:27:45 +08:00
github的话,如果你有对应repo的管理权限,简单的做法是找到你本地git的ssh(一般在~/.ssh),把pub_key的内容复制到你的github帐号里或者repo的设置里,然后直接push 到ssh地址就好了。
如果你没有repo的管理权限,基本免谈,当然你可以重新fork一个,push到自己fork的那个repo,然后merge + pull request |
10
konakona OP @lijinma 怎么可能会是你的这种疑惑...根本没有这些问题。
我描述得听清楚的啊,都是自己的版本,只不过服务器用的是 git clone 没有加帐号名称,现在服务器因为装了很多插件,想要上传到git,然后我本机下下来开发环境中再调整。 就这样咯... |
11
GhostFlying 2014-08-09 02:09:47 +08:00
@konakona git clone的时候都是不加用户信息的吧,都是在提交的时候才检查用户
|
12
konakona OP @GhostFlying 所以,你再看看我第二楼的问题。git不是我的帐号,是git平台默认的。它没有询问我我的帐号是多少,我也没有找到我应该在哪儿设置。u know? ssh公钥什么的早就设置弄好了,不然我也不能够用得了我的git(因为是私有项目)..
|
13
ivenvd 2014-08-09 03:19:06 +08:00
@konakona 四楼五楼已经说得很清楚了。你自己对问题的理解有问题,github 不认帐号,只认 key。你 Push 不了不是因为账号不对,也不是因为 key 不对,而是因为 url 不对。
|
14
thuai 2014-08-11 09:34:11 +08:00
先 ssh -T 下看账号的key对么?
|
16
konakona OP @ivenvd
[root@li671-193 CRAZYPHPER.COM]# ssh -T [email protected] [email protected]'s password: Permission denied, please try again. 以前都是这样设置key的,今天就不得了。唉.........我配了几十个git了,今天第一次遇到这样的事情。 |
17
konakona OP [root@li671-193 CRAZYPHPER.COM]# ssh -vT [email protected]
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013 debug1: Reading configuration data /root/.ssh/config debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to oschina.net [61.145.122.155] port 22. debug1: Connection established. debug1: permanently_set_uid: 0/0 debug1: identity file /root/.ssh/identity type -1 debug1: identity file /root/.ssh/identity-cert type -1 debug1: identity file /root/.ssh/id_rsa type 1 debug1: identity file /root/.ssh/id_rsa-cert type -1 debug1: identity file /root/.ssh/id_dsa type -1 debug1: identity file /root/.ssh/id_dsa-cert type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.8 debug1: match: OpenSSH_5.8 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.3 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-md5 none debug1: kex: client->server aes128-ctr hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY The authenticity of host 'oschina.net (61.145.122.155)' can't be established. RSA key fingerprint is eb:2a:c2:28:63:43:71:d2:1c:da:6b:ff:c9:85:ff:54. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'oschina.net,61.145.122.155' (RSA) to the list of known hosts. debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password,keyboard-interactive debug1: Next authentication method: publickey debug1: Trying private key: /root/.ssh/identity debug1: Offering public key: /root/.ssh/id_rsa debug1: Authentications that can continue: publickey,password,keyboard-interactive debug1: Trying private key: /root/.ssh/id_dsa debug1: Next authentication method: keyboard-interactive debug1: Authentications that can continue: publickey,password,keyboard-interactive debug1: Next authentication method: password |
18
konakona OP 我直接把.git 删了,在原项目目录上执行了如下代码:
[root@li671-193 CRAZYPHPER.COM]# git config --global user.name "konakona" [root@li671-193 CRAZYPHPER.COM]# git config --global user.email "[email protected]" [root@li671-193 CRAZYPHPER.COM]# git clone [email protected]:konakona/CRAZYPHPER.COM.git Initialized empty Git repository in /opt/lampp/htdocs/CRAZYPHPER.COM/CRAZYPHPER.COM/.git/ [email protected]'s password: Permission denied, please try again. [email protected]'s password: Permission denied, please try again. [email protected]'s password: |
19
konakona OP =.= 公钥已添加,完全没有问题啊...
就是说我密码不对。 |