Backup and restore libgdx projects on Eclipse - eclipse

I'm having trouble to working with a libgdx project on two computers.
What is the best way to backup in one computer and then restore on another?
I use the google-play-services and BaseGameUtils and have to re-importing all time.

For that i recommand to use Git, if it's new to you here are the main steps to get start :
1 - Create an account at Bitbucket : you can put your code in private mode and it's free
2 - Download and Install TortoiseGit tool: it really make life easier
3 - Create your (in Server) repository in bitbucket
4- Create your repository in Local
5 - Match between your repositories using these commands :
cd /path/to/my/repo
git remote add origin https://minos23#bitbucket.org/minos23/rep2.git
git push -u origin --all # pushes up the repo and its refs for the first time
git push -u origin --tags # pushes up any tags
You can now pull(download)/push(upload) your code with one click !!
Hope that was clear and helpful ! Good luck

Related

Rstudio: Changing origin for git version control of project

I originally set up git in Rstudio while enrolled in the Data Scientist's Toolbox course at Coursera. Unfortunately, I did this in my phd project. The repository no longer exists on github. I am now attempting to write my thesis in rmarkdown using knitr and bookdown. I would like to use version control, both to learn proper git workflow and to have a structured back up of everything I have done in my thesis. However, I have been unable to change the version control repository in Rstudio.
I am unable to change this in the Tools > Version control > Project setup > Git/SVN menu. The Origin: textbox is unchangable.
I tried creating a new project using the old phd project's working directory. This also cloned the version control settings.
How do I change the origin to accomplish what is described above?
Git, Github and Rstudio are different things. You could use git as local version control tools. You might connect your local repo to Github account which is based on git by push/pull. Rstudio just makes a user interface for git and supplies the function to push the repo into remote server based on git to make version control(not only Github, but also Gitlab).
So for your issue, if you do not want to pay for github for a private repo, all of your code would be public and I don't think it is good before your finally finished your thesis. But version control could be made locally with git only. Just use git shell to control the version.
However, as a student, github could support private repo here for you. Just register and find your student package. Then just remove the url for remote repo after you cd to your workdir in command line, use the following code to find your remote url(mostly you might fing origin):
git remote -v
Then use this to remove them:
git remote rm origin
Now you could use version control locally. If you want to connect this repo to your remote github private repo, use this:
git remote add origin https://github.com/[YourUsername]/[YourRepoName].git
RStudio would find this information about git and support your following operation. Project in RStudio is different with git, although project support git as version control tool. So you need git in command line or shell to solve your problem.
This can be done by opening /your.project/.git/config
and editing the remote origin line(s), e.g. changing from git to https.
Restart Rstudio & you'll be prompted for your github username & password.
This is what worked for me for migrating from github to Azure
Go to the top right Git window in RStudio and click on the gear. Now click Shell (to open the terminal there).
#remove origin
git remote rm origin
#add new origin like Azure for me via HTTPS
git remote add origin https://USER#dev.azure.com/USER/PROJECT/_git/REPONAME
#push your local repro
git push -u origin --all
#in my case put in the PAT password if you needed to generate one.
After testing, I found some clue
Actually Rstudio is not really smart about this setting
It will first search for the git file in the Rproject folder where your Rporject file is located
if it could not, then it goes up to the folder contains your Rproject folder
However, for version control you only need coding files while RProject may contains some big files like .RData some pictures etc.
I don't find a way to manually disrupt this logic flow, the only thing you can do is to delete the current git repository setting files(which is .git folder and 2 other git setting files), then Rstudio may ask you if you want to init a new one.

Migrate from bitbucket to GitLab

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.

How to integrate LazyBones with VCS?

I just learned about LazyBones and absolutely love it! The problem is that it generates a "code skeleton" for you before your app's VCS repo exists. And I see there is some integration capability with Git, but what about other VCSes?
Specifically, I'm using Mercurial. So ordinarily, I'd create the hg repo for my new app (on the server), clone it out locally, and some code to the cloned working copy, commit & push it.
So I ask: what is the proper workflow (or set of commands) to create a new app from a LazyBones template and integrate it with a new hg repo?
I suppose, slightly more elegant way may be:
Generate skeleton by LazyBones in SomeDir
Init Mercurial repo after it in SomeDir
Add needed files from working directory into (empty) repository
Create remote repo on server
Add remote repository URL into [path] section of local repo's .hgrc (maybe also auth. credential into [auth])
Push

How to check out a project from a server with Git

You may classify my question to the layman's level, but I am using Git for the first time (til now I used TortoiseSVN) and I am not sure how I can check out an existing project from a server, so as to have it available on my local machine in a folder. I have installed Git Bash. Should I run it (Gui), select New Archiv and then specify the path of the project in the server? Is there a better Git framework to install, which is appropriate to make the same task more easily?
I would appreciate also some screenshots if needed in the answers.
Update: I have installed also TortoiseGit. I want to create a new clone by a right click in a directory, but the new Clone is not available after the right click. Does it need additional configuration? If no, what should I do from TortoiseGit to checkout an existing project?
I'd usually recommend learning git from command line. But if you are already familiar with TortoiseSVN then TortoiseGIT is a good tool for you.
Also, I think you should learn git very well. I can recommend the book Pro Git.
To "check out" a git repository is called clone in the git world (you will get a whole copy of the server repository). This can be done either from command line or TortoiseGIT.
git bash:
$ cd /path/to/my/projects
$ git clone url-to-server-repo
Update:
Since you get the "normal" TortoiseGit menu (without clone option), it seems you already have a local git repository. You probably created an empty git repository by mistake. Look for a hidden directory .git in the project directory or any parent directory.
right click on the folder (not right click on nothing in the folder, the icon of the folder you want to clone INTO from the parent directory) and select clone from the menu.
FYI:
clone = create a copy of a repository.
checkout = change the current state of an existing repo to a saved state.
so if you have a repo w/ 3 commits (A,B,C) when you clone the repo you will be at the most current state (C). if you want to see the previous state of the repo you would git checkout B. if you want to see the repo's initial state you would git checkout A
hope that helps.

Commit an entire Netbeans project on sourceforge

I have my own PHP project in NetBeans. Afterwards I have registered a sourceforge account. Now I would use sf's git repository for versioning my code.
What I need now is to send the entire project on the repository, using netbeans. How can i do that?
Assuming you are on SourceForge's latest platform i.e. Allura, you first need to create a Git repository on SourceForge.
(You might have already done this when you first made project)
Following are the step to create git repository on it.
1) Log in to SourceForge
2) Go to Admin
3) Click on Tools
4) Click on Git. At this point, it will ask for Label and mount point for it. Enter those information. Once you finish it should create a new tab on top menu with whatever label name you provided. Let's say you named it 'Code' for now.
5) Click on 'Code' label and it would show you following instruction to push the code.
// First time using Git
cd <your_local_project_dir>
git init
git commit -a -m 'Initial commit'
git remote add origin ssh://<your_sourceforge_username>#git.code.sf.net/p/<your_project_name_on_sourceforge>/<mount_point_name_you_provide_in_step4>
git push origin master
// Existing Repository
cd <your_local_project_dir>
git remote add origin ssh://<your_sourceforge_username>#git.code.sf.net/p/<your_project_name_on_sourceforge>/<mount_point_name_you_provide_in_step4>
git push origin master
I think you might want to take a look at NetBeans' Git support;
http://netbeans.org/kb/docs/ide/git.html#initialize
It's built into the IDE so there's no plugin to install.