I'm trying to find a way to use a pipeline to push the Azure repository to another repository on my cpanel server. At the moment I'm just transfering the files over FTP but I need a proper push to activate autodeploy on cpanel repo.
Many thanks to anyone that can help.
This process would be the same the way to commit changes to a git repository.
Initialize a git repository add the data in the staging area commit changes to local git repository then push the changes to remote git repository. The process isn't different from the normal local machine one.
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin <azure repo url >
git push -u origin main
Related
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
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
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
I set-up a heroku Node project. Everything works fine but I would like to be able to push also on my bibucket repository. Git is set-up for Herokuy but when I try to add the bitbucket repository with the command:
cd /path/to/my/repo
git remote add origin git#bitbucket.org:MYUSERNAME_/PROJECTNAME.git
I get the following error:
fatal: remote origin already exists.
So I tried to run the command
git push origin master
And I get the response:
Username for 'https://github.com':
How can I push both in heroku and on my bitbucket repository?
You already have an origin repo defined (as github) so if you have the git project in bitbucket so you just need to reference as a new repo
git remote add bitbucket git#bitbucket.org:MYUSERNAME_/PROJECTNAME.git
then you will be able to run
git push bitbucket master (or any branch you have defined)
If you do not want to use github anymore and replace your origin repo with bitbucket, do
git remote set-url origin git#bitbucket.org:MYUSERNAME_/PROJECTNAME.git
and then
git push origin master
will push to your bitbucket repo - make sure to follow heroku instructions to add the heroku repo and push your files there to be deployed
Deendayal Garg gave me the right hint: with:
git remote -v
I could see that I had the original repository as origin remote. I deleted that, I unshallowed it (because the original repository was cloned with the -depth option) and I finally could add my personal bitbuket remote!
In our own Gitlab server, I accidentally removed the default admin, and the previous repo created by this default admin, is also gone.
How to recover the missing repo?
Following merlin2011's suggestion, I finally cloned my local copy to the gitlab server:
git remote -v // list all remote repo
git add repo 192.168.1.xxx //our local git server
git push -u repo master
git remote remove repo
git add origin 192.168.1.xxx
I am new in git world and recently i have started deploying puppet. I am planing to put puppet in git version control. I am following cookbook of puppet and doing following
root#cookbook:/etc/puppet# git init
Initialized empty Git repository in /etc/puppet/.git/
root#cookbook:/etc/puppet# git add manifests/ modules/
root#cookbook:/etc/puppet# git commit -m "initial commit"
[master (root-commit) c7a24cf] initial commit
59 files changed, 1790 insertions(+), 0 deletions(-)
create mode 100644 manifests/site.pp
create mode 100644 manifests/utils.pp
When i am running following command i got this error. what is command going to do??
root#cookbook:/etc/puppet# git push -u origin master
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
how do i connect to git and checkout my repo on my client or somewhere else?
You have to tell git where the remote repository is located:
git remote add origin <url-of-remote>
Edit: origin is simply a conventional name of your main remote, much like master is for your main branch.
If you have done a git init in the /etc/puppet folder it is already 'origin' and you don't have to push.
I think you just wanted to add the files to the master branch. You already did this with your commit. Try git log
I'm a complete noob when it comes to version control, but I recently started using GitHub to host some of my projects. I blindly use the command git push origin master to push changes to either of the two repositories. I don't understand how Git knows which repository to push to. I use the same command to push to each. Does the directory I'm in have anything to do with it?
Thanks for clearing this up for me.
A word of advice, "blindly use"ing anything is a bad idea.
git has a system of remotes which allows to specify URLs and transports to repositories other than the one where you're working. git push origin master pushes the current branch to the remote called origin as the branch master. You have a remote called origin. This is created by default when you clone a repository from a URL.
git remote add origin http://abc.com/def/ghi.git tells git the url that remote 'origin' points to.
When you use git push origin master, you aren't pushing to two repositories - you are pushing to the master branch in your repository who's name (alias) is origin.
Think of it like this:
I'm pushing my stuff to origin which is my repository address. What am I pushing there? My master branch.
If you are new and set git up yourself through git init, you probably aren't pushing to two repositories. Run this command to see what your remotes are:
git remote -v
This will return something like (assuming you have a git hosting service like github):
blahblah git#github.com:yourGithubName/fileName.git (fetch)
blahblah git#github.com:yourGithubName/fileName.git (push)
git#github.com:yourGithubName/fileName.git is your repository address. Some addresses are prefixed by https:// .
Git repositories contain a .git directory that contains metadata about the repository. That's what Git uses to determine where to push your changes.