I have been running gitolite for some time and this week set up a second server as a mirror for all of my repositories.
I have the following stanzas in the gitolite.conf file that has been pushed to both servers:
repo data/[0-9]+/..*
C = #developers
RW+ = #developers
R = #all
option mirror.master = oxygen
option mirror.slaves = nitrogen
repo mirror_test
RW+ = #all
option mirror.master = oxygen
option mirror.slaves = nitrogen
I have repos of the names "data/11756/machine11756.git", "data/11756/recorded11756.git", and "data/11779/machine11779.git", over 70 in total.
After setting up mirroring and testing it via the mirror_test repo. I needed to get copies of the repos onto the slave, so I then wrote a script to run "ssh gitolite mirror push nitrogen ". Only nine of these mirror pushes succeeded, the remaining ones returned:
fatal: '/home/git/repositories/data/11756/machine11756.git' 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.
What is going on?
The syntax for Gitolite mirroring should be:
ssh git#host mirror push slave-server-name repo-name
In your case, gitolite can be an entry in ~/.ssh/config.
Beside a possible SSH syntax issue, it would come done to an access or permission issue on the remote side.
Related
I was new to Gitlab was trying to push my project from local machine to Gitlab.
Have done the SSH key and followed the instructions at Gitlab. Done the Git global setup. Was trying to add an existing folder , so i followed the instructions listed
cd existing_folder
git init
git remote add origin https://gitlab.com/sss/testnode.git
git add .
git commit -m "Initial commit"
git push -u origin master
but failed at the last step at the git push. The error message was
Tried adding the remote origin, but it was told it already exists. So not sure where it went wrong. Please help, much appreciated :)
Have done the SSH key
The problem is that you have defined your origin as HTTPS, not SSH.
Try:
git remote set-url origin git#gitlab.com:sss/testnode.git
That will override origin URL.
Independently, make sure your SSH key does work and allows GitLab to authenticate you as your GitLab account with:
ssh -T git#gitlab.com
Check out your credentials, if they are invalid, it wont give u to upload changes.
For Windows check this: https://www.digitalcitizen.life/credential-manager-where-windows-stores-passwords-other-login-details
For Linux check this: https://askubuntu.com/questions/30907/password-management-applications (if you do not know how to change credentials via terminal)
I previously kept a bare git repository on a Linux server and a working copy in my local Windows laptop for development (syncing to the server using TortoiseGit over ssh). The server version was deleted/lost so I want to recreate the repo on the server using the latest commit from the local working copy on the Windows machine.
What is the best way to create this new remote bare repo copy on the remote Linux server from the Windows working copy?
You can re-create the linux server repo using
mkdir -p myrepo.git
cd myrepo.git
git init --bare
On the local copy, assuming the remote URL is the same, do
git push origin <branch refspec>
for example
git push origin master
Note: If the remote URL has changed you can use
git remote set-url origin <new-url>
Just create the repo on the server, then add the repo to your local one as remote if it is not the same location as before and push to it.
Follow these steps:
Create a bare repository on remote.
I guess the answer provided by ad22 is good enough for you:
mkdir -p myrepo.git
cd myrepo.git
git init --bare
Otherwise, you need to find out how to create a bare repository on server.
Copy or Memo the URL of that just created bare repository.
(Of cause, you need to have the right for accessing the URL.)
Add a new remote for your local repository.
Since you already have a local repository,
Right click in that repository, Click TortoiseGit -> Settings,
Give the remote a shortname and URL you copied
Add it and apply the setting.
See:
Push to remote by right clicking in local repository and click Push item.
In Push dialog,
Select the remote you just added.
Check the Push all branches checkbox if all branches can be public, otherwise you need push each branch one by one.
Check the Include Tags checkbox if you want to push all tags.
Suppose that's all. ^__^
On your Windows machine:
git clone --bare /path/to/local-working-copy-of-the-repo
The above command will create local-working-copy-of-the-repo.git folder.
Now copy the folder(bare repository) on to the Linux server.
Hope this helps.
I was set git server with gitolite and I have finished it Now. But One question truble me. I am set gitolite with both ssh and http mode.
I use the gitolite-admin.conf to control the repo and user's auth. I followed the instruction: modify the conf, git add it, git commit it and git push it. But It does't work.
In Client I can't clone the new repo I have add in the conf
this is my conf
the default repo 'testing' is working regularly
That is because gitolite honors gitolite.conf very strictly. You need to specify these lines in the conf file
repo #all
RW+ = #all
This will allow you to do operations on all the repos. But, you need to understand that when you specify #all in repo section, that means every repo falls in this rule. So, even if you have something like this in the file:
repo foo
R = xyz
gitolite ignores it because it sees that the repo foo belongs to #all. So, in order for clone operation to work, you need to specify READ permission to all the repos, something like this:
repo #all
R = #all
And then you need to add all the permissions to the other repos as well, otherwise you will only be allowed to read the other repos and not write them.
I have got a gitolite v2 installed on my company's server, and now I have to administrate it. Since it's really chaotic there I decided to install a new one, now it's v3. I have around 8 repositories what I want to move to the new install.
I don't need the old .rc file or any configurations, just the (working!) $GIT_HOME/repositories/*.git
What I tried: (found it while searching for solution)
copied all $GIT_OLD_HOME/repositories/*.git to $GIT_HOME/repositories/*.git (except gitolite-admin.git and testing.git)
then I updated the gitolite-admin.git/conf/gitolite.conf (by cloning and pushing back changes) with this kind of entries:
repo myrepo1
RW+ = #all
Now if I want to clone anything other than gitolite-admin or testing, it sais:
FATAL: R any myrepo1 myusername DENIED by fallthru
Few things I've checked:
ls -l $GIT_HOME -> gitolite:gitolite it's ok I guess since gitolite is the user I want to use
I did the same for all entries in the repositories directory and the permissions are the same.
I was googling for a solution however I didn't find any that fits my case. If you can help me or suggest me anything, please don't hold back :)
If you need any more details to find out the answer just tell me.
I had the same problem and upgrading did not work as it should so I used the following strategy - the bold text represents where was the step executed:
1- New: Install Gitolite (https://github.com/sitaramc/gitolite).
2- Workstation: In a new empty directory clone the gitolite-admin of the old version and rename it to gitolite-admin-old. Remove access to all users in gitolite-admin-old/conf/gitolite.conf except yourself - To disable anyone to do any change while you are migrating the repositories.
3- Workstation: Clone all repositories from the old Gitolite. git clone git#oldserver.com:repo.
4- Old: We already got what we want from the old repository. Disable old gitolite for good by adding exit 0 at the top of .gitolite.rc file.
5- Workstation: Clone gitolite-admin from the new server git clone git#newserver.com:gitolite-admin gitolite-admin-new
6- Workstation: Copy keys from the gitolite-admin-old/keydir to the gitolite-admin-new/keydir, add the repositories you want to transfer in the new gitolite-admin-new/conf/gitolite.conf with the user priviledges. add, commit and push.
7- Workstation: Push each required repository to the new server
git push --all git#newserver.com:repo
git push --tags git#newserver.com:repo
or
git push --mirror git#newserver.com:repo
8- Workstations: Change DNS or remote URL from each working repo.
Hope this helps
Make sure you have migrated your .gitolite.rc file, as described in the g2->g3 migration page
if you're migrating from g2, there are some settings that MUST be dealt with before running gitolite setup; please read the migration page and linked pages, and especially the one on "presetting the rc file"
The rc file for g3 is quite different from that of g2.
Or if you don't need the old one, as you mention, make sure the content of the default new one has appropriate values.
Make sure your new ~git/.ssh/authorized_keys file does contain a line with myusername in it.
The OP Attila Horvath confirms:
Note: nothing in any of the gitolite install/setup/etc will ever touch the data in any repository except the gitolite-admin repo. The only thing it will normally touch in normal repos is the update hook."
The last sentence just grabbed my attention, and it seems now that was the problem.
I first installed gitolite then copied there the repos, so I had to run again gitolite setup -pk mykey.pub and now it seems working!
I have been banging my head against a wall for a while now, and none of the people in my immediate vicinity know more than I do at this point.
My office has a lab box that they want to use for a central git repository -- mainly for testing various things. They also, of course, want me to get some experience setting up git so that we can possibly set up other git instances later.
I am running Windows 7 with an OEL 5.7 VM, and the box is running OEL 5.5. From my VM, I SSHed into the lab box and started tinkering. After installing git and gitosis, I have managed to get the instance working locally. I can see the git repository just fine, and if I try to clone it locally, it all works like a dream. But if I try to SSH in from my VM, it either A.) kicks me out with fatal: 'testproject.git' does not appear to be a git repository or B.) kicks me out with Permission denied (publickey,gssapi-with-mic), depending on how I invoke git.
Example: I configured the access to a test project I created (and tested locally) as follows:
[group team]
writable = testproject
members = oracle#RCSDB cwerness cwerness#localhost cwerness#localhost.localdomain
This is my first experience setting up a git repository, so I wanted to cover my bases regarding remote users. Thus, the redundancy in the members section.
When I try to clone the repository with my username only, I get
[cwerness#localhost Desktop]$ git clone cwerness#10.1.1.10:testproject.git
Cloning into testproject...
Enter passphrase for key '/home/cwerness/.ssh/id_rsa':
fatal: 'testproject.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
If, however, I try to clone the repository with more information, I get
[cwerness#localhost Desktop]$ git clone "cwerness#localhost.localdomain"#10.1.1.10:testproject.git
Cloning into testproject...
Permission denied (publickey,gssapi-with-mic).
fatal: The remote end hung up unexpectedly
I have all the public keys stored in the /keydir folders. The repository was created and is owned by the user oracle, and I have tried all permutations of that user and its domain in the above clone commands as well, to no effect. Additionally, I tried setting up a ~/.ssh/config file like this
Host labbox
Hostname 10.1.1.10
User cwerness
IdentityFile /home/cwerness/.ssh/id_rsa
Again, I tried all the different ways to connect, from both users. Nothing is giving me any more information than I already had.
The box is set up to authenticate SSH connections via public keys, and that works fine. I can SSH into the box as cwerness with no problems.
This is getting to be a huge headache for me, and I'd like it if someone could tell me exactly HOW I am being stupid, if not a way to fix this problem.
git clone cwerness#10.1.1.10:testproject.git will look in the home directory for the user cwerness but you state you put the repository in /home/oracle/repositories. Try git clone cwerness#10.1.1.10:/home/oracle/repositories/testproject.git.