1、选择邀请合作者。(在仓库设置里操作)

image.png

2、填入目标合作者。

image.png

3、复制网址发送给你目标合作者,让被邀请者打开网址

image.png

4、目标合作者接收到网址,用浏览器打开它,点击接受邀请。

image.png

5、接受邀请成功之后,可以在目标合作者Github账号上看到将来共同开发远程仓库

image.png

6、目标合作者可以修改内容并 push 到远程仓库

  1. # 编辑 clone 下来的文件
  2. Layne@LAPTOP-Layne MINGW64 /d/Git-Space/pro-linghuchong/git-shTest(master)
  3. $ vim hello.txt
  4. Layne@LAPTOP-Layne MINGW64 /d/Git-Space/pro-linghuchong/git-shTest(master)
  5. $ cat hello.txt
  6. hello git! hello atguigu! 2222222222222
  7. hello git! hello atguigu! 33333333333333
  8. hello git! hello atguigu!
  9. hello git! hello atguigu!
  10. hello git! hello atguigu! 我是最帅的, 比岳不群还帅
  11. hello git! hello atguigu!
  12. hello git! hello atguigu!
  13. hello git! hello atguigu!
  14. hello git! hello atguigu!
  15. hello git! hello atguigu!
  16. hello git! hello atguigu!
  17. hello git! hello atguigu!
  18. hello git! hello atguigu!
  19. hello git! hello atguigu!
  20. hello git! hello atguigu! master test
  21. hello git! hello atguigu! hot-fix test
  22. # 将编辑好的文件添加到暂存区
  23. Layne@LAPTOP-Layne MINGW64 /d/Git-Space/pro-linghuchong/git-shTest(master)
  24. $ git add hello.txt
  25. # 将暂存区的文件上传到本地库
  26. Layne@LAPTOP-Layne MINGW64 /d/Git-Space/pro-linghuchong/git-shTest(master)
  27. $ git commit -m "lhc commit" hello.txt
  28. [master 5dabe6b] lhc commit
  29. 1 file changed, 1 insertion(+), 1 deletion(-)
  30. # 将本地库的内容 push 到远程仓库
  31. Layne@LAPTOP-Layne MINGW64 /d/Git-Space/pro-linghuchong/git-shTest
  32. (master)
  33. $ git push origin master
  34. Logon failed, use ctrl+c to cancel basic credential prompt.
  35. Username for 'https://github.com': atguigulinghuchong
  36. Counting objects: 3, done.
  37. Delta compression using up to 12 threads.
  38. Compressing objects: 100% (2/2), done.
  39. Writing objects: 100% (3/3), 309 bytes | 309.00 KiB/s, done.
  40. Total 3 (delta 1), reused 0 (delta 0)
  41. remote: Resolving deltas: 100% (1/1), completed with 1 local object.
  42. To https://github.com/atguiguyueyue/git-shTest.git
  43. 7cb4d02..5dabe6b master -> master

7、回到发送合作邀请者的 GitHub 远程仓库中可以看到,最后一次是目标合作者提交的

image.png