git 操作基本步骤

1.在远程服务器上创建一个新的git库

#git init --bare project.git

5./data/git给git用户分配权限

#chown userid:groupid /data/git/project.git

6.向/data/git读写权限(如果没有写权限,好像没法push)  ※一定要记住读写权限。否则push的时候

会报error occurred during unpacking on the remote end: unpack-objects abnormal exit等类似的错误。

#chmod  -R 777 /data/git/project.git

Eclipse里Clone一个git。输入远程git的ssh地址。会要求指定本地工作目录,会在目录里创建.git目录。

这个时候,目录里是空的,然后,把eclipse工程复制到工作目录里,eclispe通过import这个工程,选择从本地git里import工程,选择刚才clone创建下来的git repository。 这个时候,工程旁边显示的是NO head,是因为远程和本地都没有任何东西,不要介意,然后team选择add to index,这个时候,每个目录和文件前面的?就会变成*,然后先commit。

这个时候,no head就会变成master,然后,到git repository视图里,选择remote,里面应该有个original

目录,下面有push,和fetch两个都是指向远程git的。右键确认一下configuration的Push URI和Ref mapings



 

然后push,应该本地的代码上传到远程了。

猜你喜欢

转载自radzhang.iteye.com/blog/2261717