I currently have Fedora 17 inside a VM on my win7 computer. I want to configure the VM to manage my projects with git. I use eclipse helios on win7 with the egit plugin with my projects currently residing locally. Git and all the dependencies are already installed on the VM. The VM's hostname is dev.local and SSH is already installed, so I would use the following URL for access: ssh://john#dev.local:/php/projects/myframework.git
My question is, how do I initialize a new git repository on my VM and then push my local project up so that it's being managed by git in the VM?
OK, i finally figured it out. What I ended up doing was on my VM which is my Git server, was create my git directory:
# mkdir /home/brett/myproject.git && cd /home/brett/myproject.git
# git init --bare
On my client, in the project's folder (C:\www\myproject):
# git init
# git add .
# git commit -m "Initial commit"
# git remote add origin ssh://brett#dev.local/myproject.git
# git push origin master
I removed my client copy of the project and in eclipse, File > Import > Git > Project from Git, Select URI.
I plugged in the details to access the git repo on dev.local and was able to create a local copy in eclipse.
Anyways, thx everyone who took the time to reply to this. I actually found a decent article online which helped.
http://www.vogella.com/articles/EGit/article.html
run a git daemon in your vm. The git protocol would make it easier for you.
Related
Using the following programs and interfaces:
R-4.2.2 for Windows
RStudio Desktop: Open Source Edition (AGPL v3)
Git Bash
GitHub
I am currently in the early stages of a tech program learning Data Analytics.
On my PC, working within RStudio, I've created a project that is currently not under version control. I am trying to get it set up to interact with Git.
When I type in my command (cd ~/dir/name/of/path/to/file) for it to move around and navigate to the directory containing my files, I keep getting this error message:
bash: cd: /c/Users/Administrator.STEPHHOWERTON/dir/name/of/path/to/file: No such file or directory"
I've tried creating different pathways. My original directory pathway was:
cd: /c/Users/Administrator.STEPHHOWERTON/RStudio Projects/Temporary_add_to_version_control
Then I tried to simplify by creating a easier path like the example in my module:
c/Desktop/Temporary_add_to_version_control
No luck with either.
I went ahead to try initialize the directory to as a Git repository and also tried to add files, but of course it said the directory was empty.
Any help would be greatly appreciated.
It is best to switch to command line (simple CMD, no bash required), after having installed Git for Windows.
Go to the root folder of your repository (not path/to/file, but path/to/root/folder/of/repository), where your project is.
You can then create a repository
git init .
git add .
git config --global user.name "your name"
git config --global user.email "your#email.com"
git commit -m "Import project"
If you need to create a GitHub repository and push your project, you can, from that same folder, after installing GitHub CLI gh, use gh auth login (with a classic PAT, scope repo):
gh auth login --with-token < echo ghp_...
Then gh repo create:
gh repo create my-project --public --source=. --push
You can reopen RStudio from there, and check everything is working.
I have multiple repositories in BitBucket. What is the most appropriate way to migrate from BitBucket to GitLab?
For an example, I maintain a repo on my system named "SSSP". What should be my steps to have a clean migration of that repository from BitBucket to GitLab?
It is better to use an intermediate local bare repo in order to duplicate one remote repo and push it to a new remote one.
Assuming you have an empty gitlab repo ready:
git clone --bare git#bitbucket.com:old/old_repo.git
cd old_repo
git remote add new-origin git#gitlab.com:new/new_repo.git
git push --mirror new-origin
cd ..
git clone git#gitlab.com:new/new_repo.git repo
cd repo
# start working
Note that this won't include the wiki (which you need to clone as well if you have some content there), or the issues.
I suppose that using the import feature via web interface will be simpler than cloning and pushing each repo.
GitLab Documentation - Import your project from Bitbucket to GitLab
Also, Gitlab can import issues in that case.
I had this issue today and the links in the above answer out of date (404 Not Found). Finally I solved it and here's the steps how i made it and hope it helps for people who need it
Step1: Bitbucket
login your bitbucket account
got to Bitbucket settings
select OAuth(on left side menu)
select Add consumer
fill in details:
Name
description
Callback URL
URL
grant permissions
Account: Email, Read
Repositories: Read
Pull Requests: Read
Issues: Read
Wiki: Read and Write
save your changes
Now the key and secret are generated like:
Step2: GitLab
open gitlab.rb file as root using vim(you can choose your preferable editor)
sudo vim /et/gitlab/gitlab.rb
initialize OmniAuth Configuration for initial settings:
gitlab_rails['omniauth_enabled'] = true
gitlab_rails['omniauth_allow_single_sign_on'] = ['saml', 'twitter']
gitlab_rails['omniauth_auto_link_ldap_user'] = true
gitlab_rails['omniauth_block_auto_created_users'] = true
add Bitbucket provider configuration(key and secret we generated):
gitlab_rails['omniauth_providers'] = [
{
"name" => "bitbucket",
"app_id" => "BITBUCKET_APP_KEY",
"app_secret" => "BITBUCKET_APP_SECRET",
"url" => "https://bitbucket.org/"
}
]
save the changes to gitlab.rb file
run command gitlab-ctl stop, gitlab-ctl reconfigure and gitlab-ctl start to reconfigure the changes and restart gitlab.
Now you can see this confirmation modal:
I don't have 50 reputation so I can't comment but VonC is right. Spent about two hours trying to get GitLab's BitBucket import feature to work - I trashed it and simply added a new origin, re-pushed --mirror and deleted the older origin. When looking at the new GitLab server, I can see all the commits from the previous Git origin / server.
cd /dev-git-repo/
git remote add new-origin https://my-gitlab.my-gitlab-repo.com/myrepo-dev-git-repo
git push --mirror new-origin
git remote remove origin
Then you can test ...
echo "\r\nThis should be seen on GitLab not bitBucket" > README.md
git commit -m "updated readme.md"
git push new-origin
And you can see README was updated on gitlab and not on bitbucket.
In case you use bitbucket-server and gitlab-ce.
First, open gitlab-ce admin interface, create a new group bitbucket-import. Afterwords create a new project within that group so that the folder /var/opt/gitlab/data/repositories/bitbucket-import should get created.
Then, copy the bare repositories from bitbucket-server data folder to gitlab-ce data folder:
cp -r /var/atlassian/application-data/stash/shared/data/repositories/* /var/opt/gitlab/data/repositories/bitbucket-import
Rename all folders from {folder} to {folder}.git. Gitlab-ce needs the .git ending to import the repository.
/var/opt/gitlab/data/repositories/bitbucket-import/
rename -n s/$/.git/ * # Dry run
rename s/$/.git/ * # Renaming
Import the repositories:
chown -R git:git /var/opt/gitlab/data/repositories/bitbucket-import/
gitlab-rake gitlab:import:repos['/var/opt/gitlab/data/repositories/'] RAILS_ENV=production
Now, you can see the imported git repositories in your gitlab admin interface represented through bitbucket id's. Here is how you can lookup the real name:
http://your-bitbucket-stash-server/rest/api/1.0/repos?limit=1000&start=0
Go to gitlab-ce project settings -> Advanced and rename your repositories.
Kind regards.
1.git -c http.sslVerify=false clone https://user#bitbkt:8443/scm/config.git
Will create clone from bitbucket on Local machine(Need proper rights for cloning the data from Bitbucket)
2.cd config
after cloning go into base folder
3.git remote add sxm https://test.com/gitlab/xyz/config.git
Had created specific group on GitLab(xyz) and created config project in it.
4. git push sxm
Will push BitBucket code on GL Gitlab.
I am setting up a development environment in my home. I have installed a centos linux in a virtual machine. All files in /var/www/html are shared with samba.
I have access to these files in windows. I have installed git in centos. I created a git repository in a sub directory of /var/www/html.
I am using Eclipse in windows. Egit is installed in Eclipse. I tried to add repository in eclipse but when I do a commit in egit, "git status" in linux displays a list of modified files to commit. Also when I do a commit in linux, all files in egit will be marked az modified.
I don't know how to synchronize egit with git. What is the correct way to do this?
The easiest solution by far would be to use a cloud service such as GitHub (or BitBucket if you want free private repositories).
An example workflow is (on terminal, however your clients will have GUI options for this):
$ git remote add origin git#bitbucket.org:username/repository
$ git push origin master
The on your other client fetch the changes and merge them in through pull
$ git pull
Both sides will need to have the same remote repository - This way you can push - pull wherever you do the work and the code be the same. I use this setup for developing and deploying my web-apps.
This solution relies on you having an internet connection - if you dont want or dont have an internet connection at your disposal then have a look at this post:
gitosis vs gitolite?
I have a Server with SSH access. On this server I have a php/yii project including a git repository (so versioned with git). Is it possible to use the EGit Team Provider (which just works fine for local projects/ .git folders) for those remote projects?
I just get nullpoint exceptions with the wizard (Share project) and cant get EGit to recognize the existing git project.
Maybe could try this by creating a fresh test .git repo on a linux server, add a php file, use eclipse remote system to browse by ssh for the folder containing the .git folder, use right click on that folder->create remote project and then somehow figure out how EGit could be added...
EGIT doesn't recognize the repository if it doesn't end with .git extension
Login to the LINUX server
cd to path in which you want the repository in
mkdir your_project_name.git //This will create the repository
git init --bare //This will actually initialize the git repository
clone this repository
add files in the local repo
add files to index, commit and push to master
I've added remote origin like:
git remote add origin https://github.com/username/repo.git
When I push the git repository, I get this error:
git push -u origin master
fatal: Unable to find remote helper for 'https'
I am on git 1.7.1 on Ubuntu 10.04.4 LTS
Any ideas, greatly appreciated
If you compiled git from source, be sure to install this package first:
apt-get install libcurl4-openssl-dev
I just got the problem yesterday and solved it today, so am posting in case this might help a Windows user. For me, the problem occurred after I updated to the latest version of Git (because Visual Studio was recommending I do so-- something about things not matching.)
It turns out that I installed in the default directory Program Files, but my old Git was in Program Files (x86). (Hadn't noticed until tried reinstalling.)
Uninstalling the new version and installing the 64-bit Git for Windows Setup listed under Other Git for Windows downloads (which is not the default) overlaying the version in Program Files (x86) worked. (I tried other combinations of version and folders first.)
I did have to delete the local repository already created and restart with git init, git add ., git commit -m "first commit", git remote add origin theGitUrl (all of which worked before), before doing the git push origin master. The weird thing is that a pop-up window appeared to enter my user name and password. I didn't notice it at first and thought the processing on the git push was hung up. So, heads up about that "Other Git for Windows" version.
I did change my Environmental Variables before the fix; I don't know if that helped. I added these 2 to the PATH:
C:\Program Files (x86)\Git\bin
C:\Program Files (x86)\Git\libexec\git-core
I did this for both User and System variables.
A note on updating the PATH in Windows 10: you have to add one at a time and not include the ;
After much searching, the answer is you need git version 1.7.7
Can't update RVM - "fatal: Unable to find remote helper for 'http'"
I was working in a chroot jail and thought i had copied everything i needed for git to work but i was missing the git-core files themselves so i just had to copy them:
cp -r /usr/lib/git-core /opt/chroot/myjail/usr/lib/
Add this to git config: (Checked in centos 6.7 and working)
#git config --global url.https://.insteadOf git://
#To see the config added
#git config --list
url.https://.insteadof=git://
user.name=username
user.email=youremail
....