How do I do an initial push to a remote repository with Git?

前端 未结 6 887
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-07 06:37

I\'ve read through countless tutorials and I keep coming up short. Here\'s what I\'ve got:

-- I\'m running RubyMine on my Windows desktop
-- I\'ve installed Gi

6条回答
  •  遥遥无期
    2020-12-07 07:28

    You can try this:

    on Server:

    adding new group to /etc/group like (example)

    mygroup:1001:michael,nir
    

    create new git repository:

    mkdir /srv/git
    cd /srv/git
    mkdir project_dir
    cd project_dir
    git --bare init (initial git repository )
    chgrp -R mygroup objects/ refs/ (change owner of directory )
    chmod -R g+w objects/ refs/ (give permission write)
    

    on Client:

    mkdir my_project
    cd my_project
    touch .gitignore
    git init
    git add .
    git commit -m "Initial commit"
    git remote add origin youruser@yourserver.com:/path/to/my_project.git
    git push origin master
    

    (Thanks Josh Lindsey for client side)

    after Client, do on Server this commands:

    cd /srv/git/project_dir
    chmod -R g+w objects/ refs/
    

    If got this error after git pull:

    There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details
    
    git pull  
    If you wish to set tracking information for this branch you can do so with:
    
    git branch --set-upstream new origin/
    

    try:

    git push -u origin master
    

    It will help.

提交回复
热议问题