简体   繁体   English

如何在git / github上实现此工作流程?

[英]How to achieve this workflow on git / github?

I have 2 computers. 我有两台电脑。 PC1 has some code that I uploaded to github following this tutorial http://kbroman.org/github_tutorial/pages/init.html PC1中有一些代码是按照本教程http://kbroman.org/github_tutorial/pages/init.html上传到github的

git init
git add
git commit
git remote add origin <url>
git push -u origin master

Now I have another PC that I will use to work on the same project and I am stuck trying to link them to the same repository. 现在,我有另一台PC将用于同一项目,并且我一直试图将它们链接到同一存储库。 fetching or pulling however seems to do nothing. 取回或拉动似乎无济于事。 My folder (local repository) is still empty. 我的文件夹(本地存储库)仍然为空。 This is what I have done so far 这是我到目前为止所做的

git init
git remote add origin <same url>
git pull

I was wondering if anyone can help me with a few simple lines for this. 我想知道是否有人可以为此提供一些简单的帮助。 I am new to git and the things i google online seem highly complicated. 我是git的新手,而我在google网上看到的东西似乎非常复杂。

在此处输入图片说明

You have to do: 你必须做:

git pull origin master

As you did not setup master as your upstream branch. 由于您没有将master设置为upstream分支。

Alternatively you can update the GIT repository using git-fetch and --track origin/master , as: 或者,您可以使用git-fetch--track origin/master更新GIT存储库,如下所示:

 git init
 git remote add origin <same url>
 git fetch -all
 git checkout --track origin/master

Following which you can simply run git pull to update local repo from remote. 接下来,您只需运行git pull即可从远程更新本地存储库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM