1

I am using git from a long time but never set it up on server. Refereeing to this Git: move existing repository from PC to server, clone from server

I have initiate a bare repo on server but while adding origin in local "git remote add origin server:path/to/repo" i have no idea what to add here. My site is getwalkwel.com and user is getwamld

Thanks

Community
  • 1
  • 1
sarabs3
  • 504
  • 7
  • 13

2 Answers2

0

Bare repository in Git is a repository which only contains version control information only in fact this will not have .git sub-directory or any working files.

This kind of repository is helpful when you need to share or divide your work between few people for example in work environment you and your team mates are working on same project and you all need to see changes and all needs to do push to repository in this case this repository is more useful.

You can add the remote repository to local git repo

$ git remote add origin ssh://myserver.com/var/git/myapp.git

pushing to remote repository:

to push our local master branch to the origin's master branch. You can do that using the git push <target> <local> command.

$ git push origin master

click here for more information on how this works

Shyam Bhimani
  • 1,310
  • 1
  • 22
  • 37
  • Thanks, i understand what bare repo is. Can you please help me in how to add origin in local git for my site.? – sarabs3 Jun 28 '16 at 07:52
  • Though your problem has been solved I have updated my answer in case it can be helpful to other users in future. @sarabs3 – Shyam Bhimani Jun 28 '16 at 19:34
0

Origin is the name of a remote which is typically created automatically when you clone a repo from another repo. The origin reference in the cloned repo will be created to point back to the repo that was cloned from. In your case, where the bare repo was actually created later from your working repo, you will create origin in your working repo to point back to your new bare repo. This is done with:

git remote add origin /barerepo/fullname

If your bare repo is going to line on a different machine, then you need the URL to reach the repo instead of just a file path.

For instance, you might have myuser@myserver:path/to/repo

Shadowfen
  • 459
  • 4
  • 11
  • Great!! it works. code has been successfully pushed to server but now how can i access it from browser like getwalkwel.com/ums. What i can see in filemanager is branches/hooks/info/objects/refs directories and config/description/HEAD files. – sarabs3 Jun 28 '16 at 12:12
  • You need to install gitweb (or one of its kindred) on the server to be served out by its http server. Gitweb is a part of the git distribution. That will allow you to browse the bare repos that you have on the server - but not write to them. – Shadowfen Jun 28 '16 at 13:40