Git pushing to a private repo

前端 未结 4 837

I have been working on my local on a web app and I was ask to push it to an empty(only read me file on it) private repo created just for this project. I\'m new to git<

4条回答
  •  攒了一身酷
    2020-12-07 12:30

    git clone is a little bit overkill for this purpose.

    The mechanism that git provides to deal with other servers is fittingly called remote. This is typically automatically set up when you clone, explaining why that was your instinct.

    Documentation can be found here:

    http://git-scm.com/book/en/Git-Basics-Working-with-Remotes

    Some summary commands:

    git remote add [remote-name] [branch-name]
    
    git fetch [remote-name]
    
    git push [remote-name] [branch-name]
    

    In addition, you might consider setting up tracking branches, which will eliminate the need to qualify the remote name each time you type a command. Documentation for that use case is here.

    http://git-scm.com/book/en/Git-Branching-Remote-Branches

    Usually, if you clone a repository, git executes git checkout -b master [remotename]/master

    Your tracking branch doesn't have to be master though.

    Hope this helps.

提交回复
热议问题