300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > 使用git建立远程仓库 让别人git clone下来

使用git建立远程仓库 让别人git clone下来

时间:2019-04-22 21:38:41

相关推荐

使用git建立远程仓库 让别人git clone下来

首先, 如果你的ssh没有安装的话,要安装ssh服务端。ubuntu是很简单

sudo apt-get install openssh-server 1,建立你的git目录。

ourunix@ubuntu:~$ mkdir testgit

ourunix@ubuntu:~$ cd testgit/

2,建立你的git仓库。

ourunix@ubuntu:~/testgit$ git init

Initialized empty Git repository in /home/wlp/testgit/.git/

3,添加你的需要的项目初始文件,这里我就只添加一张文档了。

ourunix@ubuntu:~/testgit$ echo "hello,git" > sayhi.txt

4,跟踪及提交到仓库。

ourunix@ubuntu:~/testgit$ git add sayhi.txt

ourunix@ubuntu:~/testgit$ git commit -m ".4.13" sayhi.txt

[master (root-commit) b87b535] .4.13

1 files changed, 1 insertions(+), 0 deletions(-)

create mode 100644 sayhi.txt

5.在本地的git仓库"添加一个远程仓库",当然这个远程仓库还是你自己的这个目录。

ourunix@ubuntu:~/testgit$ git remote add origin ssh://你的用户名@你的IP/~/testgit/.git

这时候,本地的.git/config应该会改变

6.将本地的master分支,跟踪到远程的分支

ourunix@ubuntu:~/testgit$ git push origin master

7,显示远程信息

ourunix@ubuntu:~/testgit$git remote show origin

8,利用其他局域网的电脑测试你的仓库

ourunix@ubuntu:~/test$ git clone ssh://你的用户名@你的IP/home/~/testgit/.git

Initialized empty Git repository in /home/wlp/test/git/.git/

xxx‘s password:

remote: Counting objects: 3, done.

Receiving objects: 100% (3/3), done.

remote: Total 3 (delta 0), reused 0 (delta 0)

9,大功告成

10.修改远程分支地址

git remote set-url origin remote_git_address

来源:/content/16/1207/10/28838452_612646555.shtml

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。