标签 git 下的文章

Git Permission denied (publickey)解决方案

听说SSH连接方式比HTTPS快的我准备改成SSH方式连接github,结果马上就非常果断的报了个错。

一查,果然是在逗我:

我们需要生成一个公钥:

 ssh-keygen -t rsa -C "foo@email.com"

上面填入你的邮箱地址。

接下来查看公钥,如果你是Mac,则在以下路径,没有关系,上面那步会显示保存路径的:

cat /Users/$USER/.ssh/id_rsa.pub

接下来我们测试连接:

ssh -T git@github.com

如果显示:

Hi foo! You've successfully authenticated, but GitHub does not provide shell access.

接下来我们就能正常构建了。

CentOS 编译安装新版git

依旧,由于CentOS,yum下载的git实在太老了,会出现cloning error,所以我们只能源代码编译安装。

首先先下载新版git:http://git-scm.com/download

接下来编译安装:

tar -zxf git-1.7.2.2.tar.gz
cd git-1.7.2.2
make prefix=/usr/local all
sudo make prefix=/usr/local install 

git push本地代码到github出错

用谷歌反倒没找到能看懂的……转自:http://www.douban.com/note/332510501/

刚创建的github版本库,在push代码时出错:

$ git push -u origin master
To git@github.com:******/Demo.git
 ! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:******/Demo.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

网上搜索了下,是因为远程repository和我本地的repository冲突导致的,而我在创建版本库后,在github的版本库页面点击了创建README.md文件的按钮创建了说明文档,但是却没有pull到本地。这样就产生了版本冲突的问题。

- 阅读剩余部分 -