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
Related
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
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!
I want to put my local git project in production server (Linux multi hosting account of go-daddy).
Is it possible to add my production server as my remote branch ?
So, having logged in via SSH:
$ mkdir mywebsite.git
$ cd mywebsite.git
$ git init --bare
on local git repo
$ git remote add production git#myserver.com:mywebsite.git
$ git push production +master:refs/heads/master
I got my solution,but thnx all of you !! :-)
You can add a new remote:
git remote add prod /url/to/empty/bare/repo
And then push your master branch to it:
git push -u prod master
But that supposes you initiated a bare repo on that production server first.
If git is installed on your server and you have cloned a copy of the repository there, you can add it as a remote using git remote.
git remote add [-t <branch>] [-m <master>] [-f] [--[no-]tags] [--mirror=<fetch|push>] <name> <url>
So:
git remote add production URL
You'd need to push from local and pull on the remote though. So you'd still have to SSH into your server to deploy.
If your end goal is simplified deployment you may wish to look into tools like Jenkins, which you can run locally and can be configured to connect to your server and deploy after running tests, etc.
That might be your best option if your hosting provider won't let you install Git.
Yes possible. You need the following command:
git remote add (remote-name)
I created an account in Gitorious and I want to upload code from my computer, but I don't know how to do it. Searching in internet I realized that I can't watch the menu to upload code from the dashboard.
I created the public SSH Key and I created a project and a repository. How can I upload the code from my computer?
Thanks.
The answer :
add new project and new repo on gitorious
on your local disc in program directory :
git init
git add .
git commit -m " name "
git remote add origin git#gitorious.org:my-project-name/my-git-repo.git
git push origin master
If you will have error :
fatal: remote origin already exists.
then :
git remote rm origin
git remote add origin git#gitorious.org:my-project-name/my-git-repo.git
git push origin master
It is based on :
faq - How do I point my local Git repository at Gitorious?
Creating a new git repository in Gitorious by kosmas
Getting started with Git and Gitorious by sagarun