简体   繁体   中英

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

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. 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.

在此处输入图片说明

You have to do:

git pull origin master

As you did not setup master as your upstream branch.

Alternatively you can update the GIT repository using git-fetch and --track origin/master , as:

 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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