Mac把Linux当成git远程仓库进行传递

1.在Linux上先创建一个空的git仓库

cd /
mkdir newgit
cd newgit
git init --bare .git

一定要使用–bare 初始化
Mac把Linux当成git远程仓库进行传递
否则push会提示错误

Mac把Linux当成git远程仓库进行传递

2.在Mac上创建好的git推送至Linux中

git push origin master

origin远程Linux .git地址,master本地.git
如果出现以下错误
Mac把Linux当成git远程仓库进行传递
说明没有传入origin地址
输入

git remote add origin ssh://[email protected]:22/newgit/.git

传递成功后,在Linux输入git log查看
Mac把Linux当成git远程仓库进行传递

3.从Linux拉取.git
在Mac中创建一个文件夹

 mkdir pullgit
 git init

要初始化,否则提示pullgit中没有初始化.git
Mac把Linux当成git远程仓库进行传递
输入git log 查看是否成功