简体   繁体   中英

setup git on an existing project in AWS EC2 instance

Need to use version control in one of the old project which resides in Amazon EC2 instance. Steps performed:

/www/box/
  1. Installed GIT on the server and initialised the folder /box/

     git init 
  2. Cloned the project in local computer

  3. Changed a file and tried to push but received error

     git push origin master Error: Updating the current branch in a non bare repository is denied 
  4. Then created another repo folder on server and used --bare tag to initialize

     /www/repos/ git init --bare 
  5. PUSH command works well on this repository

  6. Then added another REMOTE URL to the old project location git remote add production ssh:---/www/box/

Questions:

  • git push gives me the same error when pushing on to the production repo. How do I push to this production repo?

     git push production master Error: .... non bare repository is denied 
  • found lots of tutorial using HOOKS, still confused if using HOOKS is a normal method to push in GIT

In order to push to a remote repository you need two things:

1) The remote repository should be init with the --bare

2) You need to add the remote repository to your local git with "git add remote"

You don't need hooks for a normal push operation.

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