Entries tagged with “git”.
Did you find what you wanted?
Tue 12 Jul 2011
Posted by kosmas under git
No Comments
Problem
You have moved your gitolite server or you want to be able to access your gitolite server behind a firewall and port 22 for ssh is no longer available.
Solution
Edit your .git/config file and replace the line with :
url = git_user_name@http://server_ip:repo_name.git
to the following:
url = ssh://git_user_name@external_ip:non_standard_ssh_port/repo_name.git
Tue 14 Jun 2011
Posted by kosmas under git
No Comments
Problem
Your .gitignore file seems that is not working. You have added files there like db/schema.rb, but it keeps tracking the changes to it.
Solution
The cause is that the file was added to git version control before it was added in the .gitignore file. To remove the file from git tracking but without removing it from the filesystem use the following:
$ git rm --cached filename_not_to_be_tracked
Mon 30 May 2011
Posted by kosmas under Debian, git
No Comments
Problem
You are trying to set up gitolite access through gitweb but the gitweb page, shows ‘no projects avaiable’ even though you have repositories available.
Solution
Try to follow the guide here.
Some of tthe most important steps for having the right access permissions are:
- Add the www-data user in the gitolite group by:
$ sudo usermod -a -G gitolite www-data
- Add the paths to the repositories and the projects list:
$ sudo vi /etc/gitweb.conf
$projectroot ="/var/lib/gitolite/repositories";
$projects_list="/var/lib/gitolite/projects.list";
- Change the permissions in the repositories:
$ sudo chmod g+r /var/lib/gitolite/projects.list
$ sudo chmod -R g+rx /var/lib/gitolite/repositories
- Change permissions in the /var/lib/gitolite/.gitolite.rc file to allow access to the repositories:
$REPO_UMASK = 0027;
- Finally change the git-daemon to run with the gitolite group permissions in the file /etc/sv/git-daemon/run:
exec chpst -ugitdaemon:gitolite
Thu 10 Feb 2011
Problem
After the announcements in the previous posts about the security vulnerabilities in Rails 3.0.3, you would like to update your application and deploy with the latest 3.0.4 version.
Solution
- Change your Gemfile to replace
gem 'rails', '3.0.3'
with
gem 'rails', '3.0.4'
- Run:
bundle update rails
- Remove the old gems by using:
git status
and then
git rm name_of_3.0.3_gem
- Add the new gems to your git
git add vendor/cache
- Check in to your repository the new files
git commit vendor/cache -m 'upgrade to rails 3.0.4'
- Make sure that you also check in both your Gemfile and Gemfile.lock into your git repository
git commit Gemfile Gemfile.lock -m 'update Gemfiles to use 3.0.4'
otherwise when you try to deploy you will see the error:
You have modified your Gemfile in development but did not check the resulting snapshot (Gemfile.lock) into version control
- push everything to your git repository:
git push
- Deploy your application with capistrano as usual:
cap deploy
- Your new gems for 3.0.4 should be installed on the share/bundle folder
Thu 30 Dec 2010
Problem
You would like to host a new git repository in Gitorius.
Solution
Assuming that you have created your initial ruby on rails application, and you have git installed, you can follow the steps below:
- Create a new account in Gitorious
- Copy your public ssh key (usually in ~./ssh) to your new account in Gitorius
- Create a new project in Gitorius (ie My Project)
- Add a new repository in Gitorius (ie My Git Repository)
- On your local development host initialise the git repository in your project’s directory:
git init
- Add your remote hosting repository:
git remote add origin git@gitorious.org:my-project-name/my-git-repo.git
- Add your project files:
git add .
- Do your initial commit:
git commit -m "Initial commit"
- Push your project to the Gitorious repository:
git push origin master
Fri 8 Oct 2010
Problem
You have set up your capistrano recipe for deployment to dreamhost using password less logins, but after dreamhost moves your git repository server to a different server, the deployment breaks, with ‘permission denied’ when trying to get the git repository.
Solution
As the server was moved you would need to copy your ssh public key from the deployment server to the new server again for the password-less logins to work again.
Follow the details here how to copy your public key across, login in once with your password, and after that your capistrano recipe should be working again as normal.
Thu 30 Sep 2010
Problem
After dreamhost decided to move my account that hosted the git repository to a new server, first time I’ve tried to push some changes to the git repository I was faced with the followng error:
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 699 bytes, done.
Total 7 (delta 6), reused 0 (delta 0)
error: refusing to update checked out branch: refs/heads/master
error: By default, updating the current branch in a non-bare repository
error: is denied, because it will make the index and work tree inconsistent
error: with what you pushed, and will require 'git reset --hard' to match
error: the work tree to HEAD.
error:
error: You can set 'receive.denyCurrentBranch' configuration variable to
error: 'ignore' or 'warn' in the remote repository to allow pushing into
error: its current branch; however, this is not recommended unless you
error: arranged to update its work tree to match what you pushed in some
error: other way.
error:
error: To squelch this message and still keep the default behaviour, set
error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To ssh://dh_user@dh_domain/home/repository_path/projects/project.git
Solution
After searching and finding out various solutions to solve the problem, none of which was specific to a server move, I’ve tried the following:
- Followed the steps here to set up a new repository project_asm.git
- went to local project changed the config file to add the new remote repository
- issued
git push new_remote master
- make a code change and then
git push
And everything should work as normal again.
Mon 20 Sep 2010
Problem
You want to deploy your project in a server (dreamhost), that also hosts your git repository. When you try to do that by only setting the set_repository, you get errors like ‘permission denied, please try again’, even though if you try to checkout the git repository on your server works.
Solution
Set your :repository as a file in your host as in:
set :repository, "file:///home/username/git_on_server/projects/repo_name.git"
Then also set up your local_repository, as in:
set :local_repository, "user_name@server_domain_name:/home/username/git_on_server/projects/repo_name.git"
Fri 12 Mar 2010
Posted by kosmas under Dreamhost, git, linux
No Comments
Problem
You already have a project in github, but you want to move it to a different host (ie dreamhost)
Solution
Following the post here that describes how to setup a new git repository in dreamhost, the only difference after the initial setup :
ssh username@dreamhost_domain.com
mkdir -p ~/git/yourproject.git
cd ~/git/yourproject.git
git --bare init
is to edit your project’s .git/config file:
vi local_host/your_project/.git/config
and change the :
url = git@github.com:user_name/project_name.git
to the following:
ssh://dreamhost_username@dreamhost_domain/~/git/yourproject.git
Lastly you have to push for the first time to the server:
git push origin master
Optionally if you would like to check and/or checkout to a different pc you can use:
git clone ssh://dreamhost_username@dreamhost_domain/~/git/yourproject.git
Thu 2 Oct 2008
Problem
You want to install the git (Fast version control system) in Mandriva, but using:
urpmi git
installs the GNU Interactive Tools.
Solution
Use the following to install the version control system
urpmi git-core