鍍金池/ 問(wèn)答/Linux/ 關(guān)于git的問(wèn)題,不能push

關(guān)于git的問(wèn)題,不能push

和之前一樣,最后一步執(zhí)行g(shù)it push origin master,這時(shí)候提示失敗:
Permission denied (publickey).
fatal: Could not read from remote repository.

然后重新設(shè)了ssh秘鑰,并且ssh -T git@github.com是可以的,返回:
Hi xxxxxx! You've successfully authenticated, but GitHub does not provide shell access.Connection to github.com closed.
但是,git push的時(shí)候,總是失敗,提示是:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

在網(wǎng)上看到好多答案,比如在 .ssh 文件夾中執(zhí)行 ssh-add id_rsa,返回是:
Could not open a connection to your authentication agent.
又比如,git/config設(shè)置的倉(cāng)庫(kù)url地址和github使用的鏈接地址是否一致(注:這個(gè)不明白在哪里執(zhí)行,就去找到想要push的文件執(zhí)行了),

cat .git/config,返回是:
[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
    這個(gè)返回跟網(wǎng)上看到的返回不一樣,不知道怎么改。
    各位大神賜教?。。?!
    
回答
編輯回答
扯不斷

在github的配置頁(yè)中可以加入你這個(gè)主機(jī)的公鑰。
clipboard.png

如果是別人的項(xiàng)目的話,需要倉(cāng)庫(kù)的創(chuàng)建者把你添加到collaborators里面并且賦予你寫(xiě)的權(quán)限。

希望能幫助到你~

上面講的情況好像是缺少寫(xiě)權(quán)限,這里還有一個(gè)鏈接,不知道是不是和你的情況相同
https://stackoverflow.com/que...

2018年9月17日 03:45
編輯回答
青黛色

這里記錄了一下,基本上就是重新安裝git,然后重新設(shè)置公鑰http://www.cnblogs.com/hongho...

2017年2月27日 16:05