Change the branch name on github that references HEAD - github

In my remote bare repository the HEAD is pointing to "refs/heads/master" and I want it to point to "refs/heads/other".
I am not able to go to remote repository directory and run git symbolic-ref. Is there any git command to achieve it? Or any other way?
If there is no way, does Github allow one to change the HEAD?

To change it in github, go to the admin section.
You can select the default branch from a dropdown there.

(There has been posted another question asking basically the same: How do I change a Git remote HEAD to point to something besides “master”, and there was more discussion there, with a reference to the Github group. So I'd just like to point anyone to that discussion as well.)
As we know, there is no universal answer.
But there are a specific answers for various git "farms" (where multiple users can manage git repos through a restricted interface: via http and ssh): http://Github.com, http://Gitorious.org, http://repo.or.cz, Girar (http://git.altlinux.org).
These specific answers might be useful for those reading this page and thinking about these specific services.
Now they have a drop-down menu for selecting the HEAD branch at http://repo.or.cz (example: http://repo.or.cz/editproj.cgi?name=for-me-and-for-all_imz.git);
and at http://gitorious.org, too (look somewhere in the settings);
and at http://GitHub.com: admin > Default Branch > (choose something) (thanks to #srcspider's answer);
and in Girar (running on http://git.altlinux.org to build packages for ALT's distro), one can the ssh interface for this:
$ ssh git.alt help | fgrep branch
default-branch []
$
for example ssh git.alt default-branch packages/autosshd.git sisyphus to change the HEAD in the remote repo autosshd.git to point to the sisyphus branch.

Related

Using Team Services online repository without visual studio

I am trying to use a team services account to store other related documents for a project such as some spreadsheets. I want the client to have access to it, but they are not programmers so I am not wanting them to use VS.
The client can access it directly without a problem and can download files, the biggest issue is they will need to be able to upload files as well. Without using a client of some sort they are limited to 10mb or less which won't work for them.
I cannot seem to get github for the desktop to access my online repository unless I first go into VS and clone it.
I am trying to avoid having to walk the client through doing that and would like to be able to use a GUI like github desktop from end to end.
We are all in a Windows environment.
I can create a new repository in github desktop, but cannot seem to figure out how to connect it to my remote (I can't find the URL for the remote anywhere).
I feel I am so close but just missing a couple items, any push would be appreciated.
GitHub Desktop is for GitHub. GitHub is a Git repository hosting service. Not surprisingly, the GitHub tool only works with GitHub.
You can use any general-purpose Git client to interact with VSTS Git repos. SourceTree is good.
You can use some git GUI or git command line to operate local repo.
Git GUI: as Daniel Mann said, you can use soucetree, or tortoiseGit etc.
Git command line:
you can download git here ->
git clone https://account.visualstudio.com/_git/projectname ->
enter email and password to clone ->
git add . (when you add some files) ->
git commit -am 'message'(commit the changes you make) ->
git push(push your commits into VSTS git repo) ->
git pull(pull VSTS git repo changes to localt).
I am just closing this out, thank you to both folks who did answer. I understand that I am using GIT and that GitHub Desktop is for Github. I was looking for the best way to work with a Github repository without using VS and how to access the team services repo for a client of mine. I set him up with Gitkraken which is working. I was never able to figure out how to get Github Desktop to properly clone and push items, but I did not spend a ton of time in it once I used Gitkraken.
Thanks again for taking a swing at it.
I accepted the answer I did because suggesting using the command line at least shows a understanding of my question and what I was looking for.
I know I am late to the game but I can confirm that tortoise git and getext also work fine with VSTS

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.

Renaming a base branch in github

I am trying to correct a typo i.e. spelling mistake in the name of of github fork I have created. Drop a "t" from gwt-hightchart-dashboard-demo to gwt-highchart-dashboard-demo
I am not able to find out how to do this simple exercise after going through a few google/stackoverflow search.
Is this possible?
Is this possible via GitHub web GUI? How?
Is this possible via GitHub Windows GUI? How?
Is this possible via Git command prompt? How?
Reference the image below.
I don't think its possible to do this via the GUI yet but you can do this locally and push changes:
git branch -m gwt-hightchart-dashboard-demo gwt-highchart-dashboard-demo
You can just use the built in branch renaming facility to do this
git branch -m old_name new_name
Go to your repos Settings >> Options and look for "Default Branch" selection box. It will have a list of all your branches. Changing this will edit your base branch.

EGit, selecting correct parameters for URI, Host, and Repository Path.

I am very new to GIT and am trying to check out some example projects from the eclipse.org git repositories. I just installed the EGit plugin and have reached a roadblock when trying to enter the correct parameters at the "Import Projects from Git" menu.
The location of the examples I wish to check out are located here.
http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/tree/dsf
However I am unsure how to create the correct URI, Host, and Repository Path from this url.
I would like to be able to explore the different repositories listed on that page (for example the org.eclipse.cdt.examples.dsf folder) and checkout those projects, however I just can't figure out what the correct git url for this would be.
I'm coming from SVN, so I am sure I got some terminology wrong. I have been following this tutorial for using git: http://wiki.eclipse.org/EGit/User_Guide#Cloning_Remote_Repositories
If you click on "Summary" in the page you mention (http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/tree/dsf), you will get a page (http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/) which displays, at the bottom (you need to scroll down), the clone addresses:
Clone
git://git.eclipse.org/gitroot/cdt/org.eclipse.cdt.git
ssh://git.eclipse.org/gitroot/cdt/org.eclipse.cdt.git
http://git.eclipse.org/gitroot/cdt/org.eclipse.cdt.git
You can use one of those addresses to clone from Egit: see "Cloning Remote Repositories" from the user manual.
This page contains documentation from the Eclipse project about cloning their git repositories. They show an explicit example for the org.eclipse.cdt.git repository. You can use either this:
git clone git://git.eclipse.org/gitroot/cdt/org.eclipse.cdt.git
Or this:
git clone http://git.eclipse.org/gitroot/cdt/org.eclipse.cdt.git
I usually use git:// URLs when they're available. They used to be faster, but this may not be true anymore. Either should work just fine.
In general, it looks like repositories are available from git://git.eclipse.org/gitroot/<PROJECT>/<REPO>, where it's up to you to correctly substitute <PROJECT> and <REPO>.

how to rename a repository on github? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Change repo name in github
I got some github repos that i now need to rename, but i can't anywhere find a solution for this except deleting the repo and setting up a new one. I can't delete the repos, because there are a lot of links pointing to the current repos, which i don't want to loose. Anyone any idea on how to do this? (I already read a lot of the google results and searched the github support).
I have changed the name of repositories before, and I'm doing it again right now ;-)
Edit the name using the built-in feature under the "Settings" tab at the top of your GitHub repository page. Then go to your local repository and rename the remote. Like this:
First remove it:
git remote rm origin
then add back the new name
git remote add origin git#github.com:"yourname"/"projectname".git
If you have recent enough git version you should use set-url command:
git remote set-url origin git#github.com:"yourname"/"projectname".git
Now it should be good to go.
Yes you can, see here:
Rename github repo
If I understand you correctly you want to rename your git repository eg xyz.git to xyz1.git and then have all the git repositories that link to that repo link to the new name automatically?
As far as I know this isn't possible. Each repository is self contained and keeps a list of locations it links to. If one of those locations changes its name the link would be broken. Each repository that references the changed name would need to update its link.
But then, the same would happen if you deleted a repository and recreated it under a new name....
Just realised you were specifically talking about GitHub and not git in general, sorry - should learn to read the entire question like my school teachers said. The answer still stands, with the addition that you can change the name in GitHub from the Admin page.
You also do it via v3 of their API. See here:
How do I rename a GitHub repository via their API?